Go to the first, previous, next, last section, table of contents.


Is MySQL picky about reserved words?

A common problem stems from trying to create a table with column names timestamp or group, the names of datatypes and functions built into MySQL. You're allowed to do it (for example, ABS is an allowed column name), but whitespace is not allowed between a function name and the '(' when using the functions whose names are also column names.

The following are explictly reserved words in MySQL. Most of them (for example) group, are forbidden by ANSI SQL92 as column and/or table names. A few are because MySQL needs them and is (currently) using a yacc parser:

action add all alter
and as asc auto_increment
between bigint bit binary
blob both by cascade
char character change check
column columns create data
database databases date datetime
day day_hour day_minute day_second
dayofweek dec decimal default
delete desc describe distinct
double drop escaped enclosed
enum explain fields float
float4 float8 foreign from
for full grant group
having hour hour_minute hour_second
ignore in index infile
insert int integer interval
int1 int2 int3 int4
int8 into is join
key keys leading left
like lines limit lock
load long longblob longtext
match mediumblob mediumtext mediumint
middleint minute minute_second month
natural numeric no not
null on option optionally
or order outer outfile
partial precision primary procedure
privileges read real references
rename regexp repeat replace
restrict rlike select set
show smallint sql_big_tables sql_big_selects
sql_select_limit sql_log_off straight_join starting
table tables terminated text
time timestamp tinyblob tinytext
tinyint trailing to use
using unique unlock unsigned
update usage values varchar
varying varbinary with write
where year year_month zerofill
The following symbols (from the table above) are disallowed by ANSI SQL but allowed by MySQL as column/table names. This is because some of these names are very natural names and a lot of people have already used them.


Go to the first, previous, next, last section, table of contents.