我正在Access 2016数据库中运行此SQL创建表,但在CONSTRAINT子句中收到语法错误。对我来说似乎正确。约束子句中可能有什么错误。
CREATE TABLE COMPUTER(
SerialNumber Number NOT NULL,
Make Text(12) NOT NULL,
Model Text(24) NOT NULL,
ProcessorType Text(24) NULL,
ProcessorSpeed Number NOT NULL,
MainMemory Text(15) NOT NULL,
DiskSize Text(15) NOT NULL,
primary key(SerialNumber),
CONSTRAINT MAKE_CHECK (Make IN ('Dell', 'Gateway', 'HP', 'Other')),
CONSTRAINT SPEED_CHECK CHECK(ProcessorSpeed BETWEEN 1.0 AND 4.0))
答案 0 :(得分:1)
使用正确的语法:
CONSTRAINT MAKE_CHECK CHECK(Make IN ('Dell', 'Gateway', 'HP', 'Other')),