title: How do I add a custom CHECK constraint on a MySQL table?
body: <p>I am having trouble with this table</p>
  
  <pre><code>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))
  );
  </code></pre>
  
  <p>I want to have a foreign key constraint, and that works. Then, I also want to add a constraint to the attribute <code>status</code> so it can only take the values 'a', 'd' and 'u'. It is not possible for me to set the field as <code>Enum</code> or <code>set</code>.</p>
  
  <p>Can anyone tell me why this code does not work in MySQL?</p>