I am unable to create the following sample table: CREATE TABLE cds ( -> cdID INT(3) AUTO_INCREMENT PRIMARY KEY, -> artist VARCHAR(20), -> title VARCHAR(30), -> year INT(4), -> label VARCHAR(20), -> bought DATE ); I keep getting the error message: 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 '-> cdname INT(3) AUTO_INCREMENT PRIMARY KEY, -> artist VARCHAR(20), -> title V' at line 2 – 51 ms What is wrong with the query. It's something I saw in an online instruction manual.
Hmm, if all else fails, READ THE MANUAL. If you had read the manual, you would have had it fixed BEFORE you posted the question.
The following works in a new MySQL session: CREATE DATABASE rand27818; USE rand27818; CREATE TABLE sessions (id INT NOT NULL AUTO_INCREMENT, session VARCHAR(128), PRIMARY KEY(id)); DROP DATABASE rand27818; However, this-- SET @sesslen = 128; CREATE DATABASE rand27818; USE rand27818; CREATE TABLE sessions (id INT NOT NULL AUTO_INCREMENT, session VARCHAR(@sesslen), PRIMARY KEY(id)); DROP DATABASE rand27818;