BrentonHale Posted January 6, 2010 Share Posted January 6, 2010 mysql> CREATE TABLE order_contents ( -> oc_id INT(10) UNSIGNED NOT NULL -> AUTO_INCREMENT, -> order_id INT(10) UNSIGNED NOT NULL, -> print_id INT(4) UNSIGNED NOT NULL, -> quantity TINYINT UNSIGNED NOT NULL, -> DEFAULT 1, -> price decimal(6,2) NOT NULL, -> ship_date DATETIME default NULL, -> PRIMARY KEY (oc_id), -> KEY order_id (order_id), -> KEY print_id (print_id), -> KEY ship_date (ship_date) -> ) 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 'DEFA LT 1, price decimal(6,2) NOT NULL, ship_date DATETIME default NULL, PRIMARY' at line 7 mysql> What does all of these errors mean? I'm using the following MySQL Version 5.1.36 . The code looks correct unless the syntax has changed since version 4.1 . If it has, can someone give me the updated code to use. Quote Link to comment https://forums.phpfreaks.com/topic/187500-creating-a-table-in-a-database/ Share on other sites More sharing options...
Mchl Posted January 6, 2010 Share Posted January 6, 2010 As far as I can tell comma was not allowed before DEFAULT clause in 4.1 quantity TINYINT UNSIGNED NOT NULL DEFAULT 1, Quote Link to comment https://forums.phpfreaks.com/topic/187500-creating-a-table-in-a-database/#findComment-990013 Share on other sites More sharing options...
BrentonHale Posted January 6, 2010 Author Share Posted January 6, 2010 As far as I can tell comma was not allowed before DEFAULT clause in 4.1 quantity TINYINT UNSIGNED NOT NULL DEFAULT 1, Thank you! That did the trick! Quote Link to comment https://forums.phpfreaks.com/topic/187500-creating-a-table-in-a-database/#findComment-990026 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.