|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
1200+ fellow developers rate and compare features of the top IDEs, like Visual Studio, Eclipse, RAD, Delphi and others, across 13 categories. Enjoy this FREE Download of the IDE User Satisfaction Study by Evans Data Corporation. Download Now!
|
|
#1
|
|||
|
|||
|
error in sql syntax
When i try to run this:
SQL-query : CREATE TABLE algem( INDEX int( 11 ) NOT NULL default '0', titel text NOT NULL , alg text NOT NULL , PRIMARY KEY ( INDEX ) ) TYPE = MYISAM i get an error as result: 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 'int( 11 ) NOT NULL default '0', titel text NOT NULL , alg what i want is to create a table called "algem" with 3 fields 1: "index" needs to be the primary key 2: "titel" only 1 line of text 3: "alg" will contain articles i used phpmyadmin thanks |
|
#2
|
||||
|
||||
|
INDEX is a reserved word and you probably shouldn't use it for a column name. The norm would be to use "id". You can tell you've used a keyword in phpMyAdmin when it automatically capatalizes it; I believe it's another color too. Title shouldn't be a TEXT field b/c a text field's max lenght is 65565 (around there) and that's too big for a title. Use VARCHAR or TINYTEXT.
Code:
CREATE TABLE `algem` ( `id` INT UNSIGNED NOT NULL AUTO_INCREMENT , `title` VARCHAR( 100 ) NOT NULL , `alg` TEXT NOT NULL , PRIMARY KEY ( `id` ) ); |
|
#3
|
|||
|
|||
|
thanks hun
![]() |
![]() |
| Viewing: Dev Shed Forums > Other > Beginner Programming > error in sql syntax |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|