MySQL SQL Syntx Error 1064

Home / Uncategorized / MySQL SQL Syntx Error 1064

Question:
I want to create table like this,
CREATE TABLE playerinfo (
uuid varchar(255) NOT NULL PRIMARY KEY,
nickname varchar(255) NOT NULL,
firstplayed varchar(255) NOT NULL,
lastonline varchar(255) NOT NULL,
playtime bigint NOT NULL DEFAULT 0,
unit int NOT NULL DEFAULT 0,
kill int NOT NULL DEFAULT 0,
death int NOT NULL DEFAULT 0
);

But I couldn’t create table by Syntax Error 1064, in ‘kill int NOT NULL DEFAULT 0, death int NOT NULL DEFAULT 0’, I can’t find error in there. the simillar command ‘unit int NOT NULL DEFAULT 0’ doesn’t cause the error, what should I do?


Answer:
KILL is a reserved SQL keyword. You’ll have to name that column of your table something else.

A list of reserved keywords can be found here: https://dev.mysql.com/doc/refman/5.7/en/keywords.html
Read more

Leave a Reply

Your email address will not be published. Required fields are marked *