Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2

Thread: SQL error

  1. #1
    Senior Coder rafiki's Avatar
    Join Date
    Aug 2006
    Location
    Floating around somewhere...
    Posts
    2,046
    Thanks
    19
    Thanked 42 Times in 42 Posts

    SQL error

    Code:
    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?
    Code:
     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
    Last edited by rafiki; 09-03-2006 at 01:48 PM.

  • #2
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Location
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Posts
    7,691
    Thanks
    42
    Thanked 637 Times in 625 Posts
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •