主键后MYSQL语法错误

时间:2018-02-22 03:12:07

标签: mysql syntax

尝试运行此mysql:

DROP TABLE IF EXISTS Student;
CREATE TABLE IF NOT EXISTS Student
(
StudentID int(4) NOT NULL PRIMARY KEY, 
Read decimal(2,1) NOT NULL
);

但我一直收到错误:

You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'Read decimal(2,1) NOTNULL)' at line 4

非常感谢任何帮助。

1 个答案:

答案 0 :(得分:0)

READ是一个有问题的关键字,因此请更改或转义

试试这个

CREATE TABLE IF NOT EXISTS Student
(
StudentID int(4) NOT NULL PRIMARY KEY, 
`Read` decimal(2,1) NOT NULL
);