title: Add a tuple-based CHECK constraint to a table
body: <p>I have a table PC that has 5 columns:</p>
  
  <pre><code>CREATE TABLE PC 
  (
      model VARCHAR(25),
      speed FLOAT,
      ram, INT,
      hd INT,
      price FLOAT,
      PRIMARY KEY (model)
  );
  </code></pre>
  
  <p>I have to add a tuple-based CHECK constraint to verify that a PC with a speed less than 2.0 must not sell for more than $600.</p>
  
  <p>So far, what I have is:</p>
  
  <pre><code>ALTER TABLE PC
  ADD CONSTRAINT pc_chk
  CHECK (
      SELECT price FROM PC WHERE speed &lt; 2.0
  ) &lt; 600;
  </code></pre>
  
  <p>This yields an error in MySQL so clearly I am doing something wrong. Can someone give me a hint? </p>