...

View Full Version : SQL error



rafiki
09-03-2006, 12:44 PM
CREATE TABLE `students` (`id` INT(6) DEFAULT '0' NOT NULL AUTO_INCREMENT PRIMARY KEY,
`firstname` CHAR(30) NOT NULL, `surname` CHAR(30) NOT NULL, `dob` DATE(10) NOT NULL, `siblings`
CHAR(2) NOT NULL, `bedtime` TIME(2) NOT NULL, `wakeup` TIME(5) NOT NULL, `homework` CHAR(2) NOT
NULL, `tv` CHAR(2) NOT NULL, `computer` CHAR(2) NOT NULL, `family` CHAR(2) NOT NULL, `friends`
CHAR(2) NOT NULL, `school_year` CHAR(2) NOT NULL, PRIMARY KEY (`firstname`, `surname`, `dob`,
`siblings`, `bedtime`, `wakeup`, `homework`, `tv`, `computer`, `family`, `friends`))
any see wats wrong with this?

MySQL said:

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 '(10) NOT NULL, `siblings` CHAR(2) NOT NULL, `bedtime` TIME(2) N

Fumigator
09-03-2006, 04:46 PM
4 problems-- you can't specify a size on date or time fields (that's 3 problems right there), and you can't specify two primary keys.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum