我试图在PHPMyAdmin中运行这个简单的SQL但是它一直在抛出这个错误:c
#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 '' at line 1
尝试运行此代码时:
CREATE TABLE tasks (task_id INT UNSIGNED NOT NULL AUTO_INCREMENT,parent_id INT UNSIGNED
NOT NULL DEFAULT 0,task VARCHAR(100) NOT NULL,date_added TIMESTAMP NOT NULL,date_completed
TIMESTAMP,PRIMARY KEY (task_id),INDEX parent (parent_id),INDEX added (date_added),INDEX
completed (date_completed);
我尝试使用和不使用;
运行此代码当然,任何帮助都是最受欢迎的!
答案 0 :(得分:1)
您缺少结束括号:
CREATE TABLE tasks (
task_id INT UNSIGNED NOT NULL AUTO_INCREMENT,
parent_id INT UNSIGNED NOT NULL DEFAULT 0,
task VARCHAR(100) NOT NULL,
date_added TIMESTAMP NOT NULL,
date_completed TIMESTAMP,
PRIMARY KEY (task_id),
INDEX parent (parent_id),
INDEX added (date_added),
INDEX completed (date_completed)
);
答案 1 :(得分:0)
你忘记了最后的括号:
CREATE TABLE tasks (
task_id INT UNSIGNED NOT NULL AUTO_INCREMENT,
parent_id INT UNSIGNED NOT NULL DEFAULT 0,
task VARCHAR(100) NOT NULL,
date_added TIMESTAMP NOT NULL,
date_completed TIMESTAMP,
PRIMARY KEY (task_id),
INDEX parent (parent_id),
INDEX added (date_added),
INDEX completed (date_completed)
);
答案 2 :(得分:-2)
试试这个
CREATE TABLE tasks (task_id INT UNSIGNED NOT NULL AUTO_INCREMENT,parent_id INT UNSIGNED NOT NULL DEFAULT 0,task VARCHAR(100) NOT NULL,date_added TIMESTAMP NOT NULL,date_completed TIMESTAMP,PRIMARY KEY (task_id),INDEX parent (parent_id),INDEX added (date_added),INDEX completed (date_completed));