MySQL Forums
Forum List  »  Newbie

Getting syntax error on table create, don't know why
Posted by: Derek
Date: June 29, 2005 11:49AM

Here is the complete sql statement I'm trying to run. It craps out on the 2nd table create (I think). Thanks for any help! - Derek


create database proj;
use proj;

# create source table

CREATE TABLE source (
	sourceid		INT UNSIGNED NOT NULL AUTO_INCREMENT,
	source_name	VARCHAR(40) NOT NULL,
	source_url	VARCHAR(40) NOT NULL,
	source_login	VARCHAR(30) NOT NULL,
	source_pswrd	VARCHAR(30) NOT NULL,
	source_dship	ENUM('Y','N') NOT NULL,
	PRIMARY KEY (sourceid)
) ENGINE = InnoDB;

# create Iventory table

CREATE TABLE inventory (
	item_sourceid	INT UNSIGNED NOT NULL,
	source_itemid	VARCHAR(20) NOT NULL,
	item_name	VARCHAR(20) NOT NULL,
	item_title		VARCHAR(40) NOT NULL,
	item_descrip	MEDIUMBLOB NOT NULL,
	item_status	ENUM('Active','Out-of-Stock') NOT NULL,
	item_price	INT UNSIGNED NOT NULL,
	PRIMARY KEY (item_source, item_sourceid)
) ENGINE = InnoDB;

# create customer table

CREATE TABLE customers (
	cust_id		INT UNSIGNED NOT NULL AUTO_INCREMENT,
	cust_fname	VARCHAR(20) NOT NULL,
	cust_lname	VARCHAR(20) NOT NULL,
	cust_email	VARCHAR(20) NOT NULL,
	cust_addr		VARCHAR(20) NOT NULL,
	cust_addr2l	VARCHAR(20) NOT NULL,
	cust_city		VARCHAR(20) NOT NULL,
	cust_state	VARCHAR(20) NOT NULL,
	cust_ip		TEXT UNSIGNED NOT NULL,
	cust_date		DATE NOT NULL,
	cust_nletter	ENUM('Y','N') NOT NULL,
	PRIMARY KEY (cust_id)
) ENGINE = InnoDB;


# create orders table

CREATE TABLE orders (
	order_id		INT UNSIGNED NOT NULL AUTO_INCREMENT,
	order_custid	INT UNSIGNED NOT NULL,
	order_date	DATE NOT NULL,
	order_itemid	INT UNSIGNED NOT NULL,
	PRIMARY KEY (order_id, order_date),
	FOREIGN KEY (order_custid) REFERENCES customers (cust_id),
) ENGINE = InnoDB;


Options: ReplyQuote


Subject
Written By
Posted
Getting syntax error on table create, don't know why
June 29, 2005 11:49AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.