would anybody please point out what is wrong with the "order table" .. i spent hours and can't figure it out why this simple table won't work. i appreciate it.

CREATE TABLE customer(
cid INTEGER PRIMARY KEY NOT NULL AUTO_INCREMENT,
fn VARCHAR(10),
ln VARCHAR(10),
phone VARCHAR(15));

CREATE TABLE address(
street VARCHAR(40) PRIMARY KEY NOT NULL,
city VARCHAR(10),
cid INTEGER NOT NULL,
FOREIGN KEY(cid) REFERENCES customer(cid));


CREATE TABLE order(
oid INTEGER PRIMARY KEY NOT NULL AUTO_INCREMENT,
o_price DOUBLE(5,2),
o_date VARCHAR(10), 
o_time VARCHAR(10),
cid INTEGER NOT NULL,
FOREIGN KEY(cid) REFERENCES customer(cid));

Recommended Answers

All 2 Replies

Change the name of the table 'Order'. It is a reserved word

Or use backticks (`) around table name.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.