As you know, MySQL uses some keywords and some of them are also reserved.
Let’s have a look how to deal with that:
mysql> create table WRITE (id int auto_increment primary key, varying varchar(10), than int);
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 'WRITE (id int auto_increment primary key,
varying varchar(10), than int)' at line 1
OK, it seems WRITE is a keyword I cannot use as table name. I’ve then two choices:
- rename the table to something else like WRITE_TBL
- use back-ticks (`) around the table like `WRITE`
Let’s use the first option:
mysql> create table WRITE_TBL (id int auto_increment primary key, varying varchar(10), than …[Read more]