为什么我在T-SQL中收到此错误
问题描述:
我正在为我的大学课学习SQL,我应该创建一些非常基本的表。这个因某些原因不起作用。请帮忙。
消息102,等级15,状态1,行9
语法附近')'
I am studying SQL for my college class and I am supposed to create some very basic tables. This one won't work for some reason. Please help.
Msg 102, Level 15, State 1, Line 9
Incorrect syntax near ')'
CREATE TABLE Member_Activity
(
Activity_Type NVARCHAR(4) NOT NULL,
"Member_ID" INT IDENTITY(1,1) NOT NULL,
Posts REAL NOT NULL,
Messages REAL NOT NULL,
CONSTRAINT "PK_Activity_Type" PRIMARY KEY(Activity_Type),
CONSTRAINT "FK_Member_ID" FOREIGN KEY(Member_ID)
);
答
您的外键定义不完整。它必须说出它引用的表和列:
Your foreign key definition is incomplete. It must say what table and column it is referencing:
CONSTRAINT "FK_Member_ID" FOREIGN KEY(Member_ID) REFERENCES Member(Memeber_ID)