PDA

View Full Version : Can anyone tell me what I have done wrong in the short MySQL command?


nikos101
08-09-2007, 04:14 PM
Can anyone tell me what I have done wrong in the short MySQL command?

mysql> use dvdrentals
Database changed
mysql> CREATE TABLE DVDs(
-> DVDID SMALLINT NOT NULL AUTO_INCREMENT PRIMARY KEY,
-> DVDName VARCHAR(60) NOT NULL,
-> NumDisks TINYINT NOT NULL DEFULT 1,
-> YearRlsd YEAR NOT NULL,
-> MTypeID VARCHAR(4) NOT NULL,
-> StudID VARCHAR(4) NOT NULL,
-> RatingID VARCHAR(4) NOT NULL,
-> FormID CHAR(2) NOT NULL,
-> StatID CHAR(3) NOT NULL,
-> FOREIGN KEY (MTypeID) REFERENCES MovieTypes (MTypeID),
-> FOREIGN KEY (StudID) REFERENCES Studios (StudID),
-> FOREIGN KEY (RatingID) REFERENCES Ratings (RatingID),
-> FOREIGN KEY (FormID) REFERENCES Formats (FormID),
-> FOREIGN KEY (StatID) REFERENCES Status (StatID),
-> )
-> ENGINE=INNODB;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'DEFUL
T 1,
YearRlsd YEAR NOT NULL,
MTypeID VARCHAR(4) NOT NULL,
StudID VARCHAR(4)' at line 4
mysql>

CFMaBiSmAd
08-09-2007, 05:20 PM
Try spelling it: DEFAULT

nikos101
08-09-2007, 06:12 PM
opps, I can't believe I missed that. The error messages were not much help

thx CFMaBiSmAd

guelphdad
08-10-2007, 03:29 AM
how do you think the error message wasn't much help? you posted it above, it told you exactly where the error message was.

nikos101
08-10-2007, 12:37 PM
Yeah I figured that soon after, somehow because default was spelt over 2 lines I didn't spot it :(