有人能告诉我为什么我在第 6 行收到语法错误吗
谢谢!
CREATE TABLE schools (
schoolID int NOT NULL AUTO_INCREMENT PRIMARY KEY,
parentID int NOT NULL DEFAULT '0',
schoolname VARCHAR(199) NOT NULL,
active int NOT NULL,
dateENTERED datetime NOT NULL
),
如果您,
从最后一行中删除它应该可以工作 -
测试代码 -
CREATE TABLE schools (
schoolID int NOT NULL AUTO_INCREMENT PRIMARY KEY,
parentID int NOT NULL DEFAULT '0',
schoolname VARCHAR(199) NOT NULL,
active int NOT NULL,
dateENTERED datetime NOT NULL
);
甚至这也有效(在 phpmyadmin 中测试)
CREATE TABLE schools (
schoolID int NOT NULL AUTO_INCREMENT PRIMARY KEY,
parentID int NOT NULL DEFAULT '0',
schoolname VARCHAR(199) NOT NULL,
active int NOT NULL,
dateENTERED datetime NOT NULL
)
Assuming that line six is the the dateEnterered, Try something like:
dateEntered timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
And yes, change the comma to a semi-colon.