access做sql生成表时运行时候老是提示语法错误。求高人看看错在哪了
CREATETABLES(SNOSMALLINTPrimarykey,SNAMECHAR(20),CITYCHAR(20));CREATETABLEP(PNOSMALLI...
CREATE TABLE S
(SNO SMALLINT Primary key,
SNAME CHAR(20),
CITY CHAR(20) );
CREATE TABLE P
(PNO SMALLINT Primary key,
PNAME CHAR(20),
WEIGHT CHAR(20),
COLOR CHAR(20));
CREATE TABLE J
(JNO SMALLINT PRIMARY Key,
JNAME CHAR(20),
CITY CHAR(20));
CREATE TABLE SPJ
(SON SMALLINT,
PNO SMALLINT,
JNO SMALLINT,
QTY CHAR(20)
FOREIGN KEY ( SNO )
REFERENCES S ( SNO ),
FOREIGN KEY ( PNO )
REFERENCES P ( PNO )
FOREIGN KEY (JNO)
REFERENCES J(JNO)
); 展开
(SNO SMALLINT Primary key,
SNAME CHAR(20),
CITY CHAR(20) );
CREATE TABLE P
(PNO SMALLINT Primary key,
PNAME CHAR(20),
WEIGHT CHAR(20),
COLOR CHAR(20));
CREATE TABLE J
(JNO SMALLINT PRIMARY Key,
JNAME CHAR(20),
CITY CHAR(20));
CREATE TABLE SPJ
(SON SMALLINT,
PNO SMALLINT,
JNO SMALLINT,
QTY CHAR(20)
FOREIGN KEY ( SNO )
REFERENCES S ( SNO ),
FOREIGN KEY ( PNO )
REFERENCES P ( PNO )
FOREIGN KEY (JNO)
REFERENCES J(JNO)
); 展开
1个回答
展开全部
前三个没问题,就最后SPJ问题很多
CREATE TABLE SPJ
(SNO SMALLINT, --这个应该叫SNO,你起名叫SON吧?
PNO SMALLINT,
JNO SMALLINT,
QTY CHAR(20),--这个字段是数量,应该用数字型,但你用的字符型,虽然不报错,但你计算时就不对了,就不给你改了,自己改一下,还有,后边要有个逗号
FOREIGN KEY ( SNO ) REFERENCES S ( SNO ),
FOREIGN KEY ( PNO ) REFERENCES P ( PNO ), --这地方你好像也少个逗号
FOREIGN KEY (JNO) REFERENCES J(JNO));
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询