MySQL Database

ID #193

phpMyAdmin gives SQL syntax error when I try to create table.

Applies to: Grid System

If you are getting errors when you try to create a table like:

CREATE TABLE ´foo´ (
´bar´ VARCHAR NOT NULL
)

and get a MySQL error:

MySQL said:
You have an error in your SQL syntax near 'NOT NULL)' at line 1

Then this probably means that you have forgotten to specify a length for the Varchar type in the "Length/Values" column, which is a required field.

So, this is wrong:

CREATE TABLE bla (bla VARCHAR NOT NULL);

and this is correct:

CREATE TABLE bla (bla VARCHAR(25) NOT NULL);

Last update: 2010-10-03 16:27
Author: FAQ Admin
Revision: 1.2

Digg it! Share on Facebook Print this record Send FAQ to a friend Show this as PDF file
Please rate this FAQ:

Average rating: 1 (1 Vote)

completely useless 1 2 3 4 5 most valuable

You can comment this FAQ