I have a table PC that has 5 columns:
CREATE TABLE PC
(
model VARCHAR(25),
speed FLOAT,
ram, INT,
hd INT,
price FLOAT,
PRIMARY KEY (model)
);
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.
So far, what I have is:
ALTER TABLE PC
ADD CONSTRAINT pc_chk
CHECK (
SELECT price FROM PC WHERE speed < 2.0
) < 600;
This yields an error in MySQL so clearly I am doing something wrong. Can someone give me a hint?