gpt4 book ai didi

mysql - 检查mysql的约束

转载 作者:行者123 更新时间:2023-11-29 01:35:49 31 4
gpt4 key购买 nike

<分区>

任何人都可以帮助我正确地为 MYSQL 中的 CHECK CONSTRAINT 编写正确的语法。我的表如下,在为 STATUS 声明 CHECK 约束时出错。

CREATE TABLE EventRequest (
EventNo CHAR(8) NOT NULL,
DateHeld DATE NOT NULL,
DateReq DATE NOT NULL,
FacNo CHAR(8)NOT NULL,
CustNo CHAR(8) NOT NULL,
DateAuth DATE,
Status CHAR(8)NOT NULL,
EstCost DECIMAL(9,4)NOT NULL,
EstAudience INT(6) NOT NULL,
BudNo VARCHAR2(8),
CONSTRAINT PK_EVENTREQUEST PRIMARY KEY (EventNo),
CONSTRAINT FK_FACNO FOREIGN KEY (FacNo) REFERENCES FACILITY (FacNo),
CONSTRAINT FK_CUSTNO FOREIGN KEY (CustNo) REFERENCES CUSTOMER (CustNo),
CONSTRAINT Check_Status
CHECK (Status IN ('Approved','Pending','Denied') ) ) ;

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com