我在这张桌子上遇到麻烦
CREATE TABLE `Participants` (
`meetid` int(11) NOT NULL,
`pid` varchar(15) NOT NULL,
`status` char(1) DEFAULT NULL,
PRIMARY KEY (`meetid`,`pid`),
CONSTRAINT `participants_ibfk_1` FOREIGN KEY (`meetid`) REFERENCES `Meetings` (`meetid`) ON DELETE CASCADE
CONSTRAINT `participants_ibfk_2` CHECK (status IN ('a','d','u'))
CONSTRAINT `participants_ibfk_3` CHECK (pid IN (SELECT name FROM Rooms) OR pid IN (SELECT userid FROM People))
);
我想要一个外键约束,并且可以。然后,我还想向该属性添加一个约束,status以便它只能采用值“ a”,“ d”和“ u”。我无法将字段设置为Enum或set。
谁能告诉我为什么这段代码在MySQL中不起作用?
子衿沉夜
达令说
相关分类