Beginner question: Is there a way to write a check constraint that restricts data where a condition is met. For instance, if I want to not allow appointment times between 1100 and 1300 on a specific day.
ALTER TABLE appointment_info
ADD CONSTRAINT ap_time_ck CHECK (ap_time NOT BETWEEN 11 and 13);
I tried
ALTER TABLE appointment_info
ADD CONSTRAINT ap_time_ck CHECK (ap_time NOT BETWEEN 11 and 13 AND ap_date != '02-APR-2014');
But obviously that will restrict all appointment times between 1100 and 1300 and any appointments on April 2nd.