i have table of cars and i need to put constraint,
if car.speed<1200 then price<=90000
I try this:
ALTER TABLE CARS ADD CONSTRAINT price_speed_chk CHECK( CASE WHEN speed <1200 THEN price<=90000 ); it's doesn't work.
who can help ? thanks!
You are using CASE completely a wrong way. If you need a check with that logic, you can simply use some boolean operators:
ALTER TABLE CARS ADD CONSTRAINT price_speed_chk CHECK(speed >= 1200 OR price<=90000 );