I'm quite new on learning SQL and I seem to be running into an issue with the following code:
CREATE TABLE `read`
(`order` NOT NULL UNIQUE AUTO_INCREMENT,
`title` VARCHAR(50) NOT NULL,
`url` VARCHAR(50) NOT NULL,
PRIMARY KEY(`title`,`url`)
)DEFAULT CHARSET=UTF8;
It's returning the following error:
#1064 - 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 'NOT NULL UNIQUE AUTO_INCREMENT, title
VARCHAR(50) NOT NULL, url
VARCHAR(50' at line 2
INT
afterorder
solves it.order
. And why have you accepted that answer? It doesn't explain what is wrong, it removes theUNIQUE
constraint, it changes thePRIMARY KEY
. Not very helpful. Do you know you can post an answer yourself?