CREATE TABLE 'categories'(
'id' SMALLINT NOT NULL AUTO_INCREMENT,
'category' VARCHAR(30) NOT NULL,
PRIMARY KEY ('id'),
UNIQUE KEY 'category' ('category')
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE 'orders' (
'id' INT UNSIGNED NOT NULL AUTO_INCREMENT,
'user_id' INT UNSIGNED NOT NULL,
'transaction_id' VARCHAR(19) NOT NULL,
'payment_status' VARCHAR(15) NOT NULL,
'payment_amount' DECIMAL(6,2) UNSIGNED NOT NULL,
'payment_date_time' TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY ('id'),
KEY 'user_id' ('user_id')
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE 'pages' (
'id' MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT,
'category_id' SMALLINT UNSIGNED NOT NULL,
'title' VARCHAR(100) NOT NULL,
'description' TINYTEXT NOT NULL,
'content' LONGTEXT NOT NULL,
'date_created' TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY ('id'),
KEY 'category_id' ('category_id'),
KEY 'creation_date' ('date_created')
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE 'pdfs' (
'id' SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT,
'tmp_name' CHAR(40) NOT NULL,
'title' VARCHAR(100) NOT NULL,
'description' TINYTEXT NOT NULL,
'file_name' VARCHAR(40) NOT NULL,
'size' MEDIUMINT UNSIGNED NOT NULL,
'date_created' TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY ('id'),
UNIQUE KEY 'tmp_name' ('tmp_name'),
KEY 'date_created' ('date_created')
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE 'users' (
'id' INT UNSIGNED NOT NULL AUTO_INCREMENT,
'type' ENUM ('member','admin') NOT NULL,
'username' VARCHAR(30) NOT NULL,
'email' VARCHAR(80) NOT NULL,
'pass' VARBINARY(32) NOT NULL,
'first_name' VARCHAR(20) NOT NULL,
'last_name' VARCHAR (40) NOT NULL,
'date_expires' DATE NOT NULL,
'date_created' TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
'date_modified' TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY ('id'),
UNIQUE KEY 'username' ('username'),
UNIQUE KEY 'email' ('email')
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
.................................. ...........................................SQL語法錯誤 - 找不到錯誤
我找不到這裏的SQL錯誤。
MySQL表示:
#1064 - 你在你的SQL語法錯誤; ('id'SMALLINT NOT NULL AUTO_INCREMENT,'category'VARCHAR(30)NOT'on line 1
請幫忙查看對應於您的MySQL服務器版本的手冊。我使用的是共享服務器上的MySQL 4.4.x到。
不確定這是否是問題,但您不需要圍繞表名引用單引號。可能是什麼東西扔掉了。我會先創建一張表,看看它是否是下行的,可能會崩潰它 – Brian 2012-02-27 15:48:06
MySQL 4.4?真? – gbn 2012-02-27 15:51:00