mysql - 找不到MySQL语法错误

标签 mysql

USE waterloo;

DROP TABLE IF EXISTS waterloo;
CREATE TABLE waterloo
(
id              int unsigned NOT NULL auto_increment,   # Unique ID for the record
building        varchar(255) NOT NULL,                  # Name of building
floor           int unsigned NOT NULL,                  # Floor of building
gender          varchar(255) NOT NULL,                  # Gender of bathroom
location        int unsigned NOT NULL,                  # Convenience of location of     bathroom
cleanliness     int unsigned NOT NULL,                  # Cleanliness of bathroom
stalls          int unsigned NOT NULL,                  # Number of stalls
noise           int unsigned NOT NULL,                  # Ambient noise
lines           int unsigned NOT NULL,                  # Length of lines at peak hours
graffiti        int unsigned NOT NULL,                  # Amount of graffiti on the walls
PRIMARY KEY     (id)
);

我收到以下错误:

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 'lines int unsigned NOT NULL, graffiti int unsigned NOT NULL )' at line 11

最佳答案

LINES 是 MySQL 中的保留字。不过,您仍然可以将其用作列名称。只需将其包裹在背面即可

`lines`

关于mysql - 找不到MySQL语法错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14906322/

相关文章:

mysql - 如何使用 Sequelize 将每行 2 列相乘并对所有结果求和?

mysql - 将列转换为行

mysql - 如何获取 GROUP BY 的最后一项

mysql - 按 2 个值之间的平均评分排序

php - 我可以在 PHP 中混合使用 MySQL API 吗?

php - 如何在 pdf-viewer 中创建加载器

php - 在 php 中分组以构建报告

mysql - 连接两个并按限制排序的 SQL

mysql - 在子查询中使用自引用更新行

mysql - 如何在没有互联网连接的Ubuntu服务器上安装Mysql服务器