我正在为体育用品商店创建一个数据库,并且正在尝试为设备创建一个表格。这段代码有语法错误,我无法弄清楚问题是什么。
CREATE TABLE Equipment
(
EquipmentID Int NOT NULL IDENTITY(100,1) PRIMARY KEY,
EquipmentName NChar(50) NOT NULL,
Sport NChar(15) NULL,
Manufacturer NChar(50) NULL,
Price smallmoney NOT NULL,
Quantity int NOT NULL,
/*Sport must be one of the following*/
CONSTRAINT SportCheck
CHECK (Sport IN ('Baseball', 'Football', 'Basketball', 'Hockey',
'Soccer'))
CONSTRAINT ValidQuantity CHECK (Quantity >= 0),
);
答案 0 :(得分:2)
您在CONSTRAINT ValidQuantity
CREATE TABLE Equipment (
EquipmentID Int NOT NULL IDENTITY(100,1) PRIMARY KEY,
EquipmentName NChar(50) NOT NULL,
Sport NChar(15) NULL,
Manufacturer NChar(50) NULL,
Price smallmoney NOT NULL,
Quantity int NOT NULL,
/*Sport must be one of the following*/
CONSTRAINT SportCheck
Check (Sport IN ('Baseball', 'Football', 'Basketball', 'Hockey',
'Soccer')),
CONSTRAINT ValidQuantity
Check (Quantity >= 0),
);