[英]What's wrong with the SQL?
CREATE TABLE IF NOT EXISTS customers (customer_id TEXT NOT NULL, time_stamp TIMESTAMP NOT NULL, customer_info TEXT), PRIMARY KEY (time_stamp)
错误是
mysql> CREATE TABLE IF NOT EXISTS customers (customer_id TEXT NOT NULL, time_stamp TIMESTAMP NOT NULL,
customer_info TEXT), PRIMARY KEY (time_stamp);
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 ' PRIMARY KEY (time_stamp)' at line 1
需要在CREATE TABLE
括号内定义主键列:
CREATE TABLE IF NOT EXISTS customers (
customer_id TEXT NOT NULL,
time_stamp TIMESTAMP NOT NULL,
customer_info TEXT,
PRIMARY KEY (time_stamp)
)
我很好奇为什么您没有将customer_id
为可索引的数据类型,因此没有将主键列设置为...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.