CREATE TABLE Message(
MessageID int unsigned not null auto_increment primary key,
naiveUserID int unsigned(7) NOT NULL,
Title varchar(20),
bodyOfText TEXT(2000)
);
我一直尝试在Mysql5数据库上运行这个简单的创建表简介,但不断收到错误:
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 '(7) NOT NULL,
Title varchar(20),
bodyOfText TEXT(2000)
)' at line 3
我已经从几个不同的站点用谷歌搜索了正确的语法,但无法运行任何东西! 令人抓狂的是,当我使用老师的代码时,除了某些数据类型之外,它与此非常相似,它可以完美运行:
CREATE TABLE EMPL (
Eid int unsigned not null auto_increment primary key,
Name varchar(20),
title varchar(30),
salary int,
emailsuffix varchar(60)
);
这是因为你的语法确实是错误的:没有int unsigned(7)
类型;试试这个:
CREATE TABLE Message(
MessageID int unsigned not null auto_increment primary key,
naiveUserID int(7) unsigned NOT NULL,
Title varchar(20),
bodyOfText TEXT(2000)
);
或:
CREATE TABLE Message(
MessageID int unsigned not null auto_increment primary key,
naiveUserID int unsigned NOT NULL,
Title varchar(20),
bodyOfText TEXT(2000)
);