Define an interval while entering values in a table

I have created a table as follows:

CREATE table screening
(
  screening_id NUMBER(6,0) PRIMARY KEY,
  plan_id NUMBER(4,0),
  theatre_id NUMBER(1,0),
  screening_date DATE,
  screening_start_hh24 NUMBER(2,0) CHECK(screening_start_hh24 BETWEEN 9 AND 22),
  screening_start_mm60 NUMBER(2,0) CHECK(screening_start_mm60 BETWEEN 0 AND 59),
  CONSTRAINT fk_plan_id FOREIGN KEY(plan_id)
    REFERENCES screening_plan(plan_id),
  CONSTRAINT fk_theatre_id_screening FOREIGN KEY(theatre_id)
    REFERENCES theatre(theatre_id)
)

‘screening_start_hh24’ is for start time in hour and ‘screening_start_mm60’ is for start time in minutes.
What should I do to add a break of at least 30mins between two consecutive screenings in the same theatre? I am using oracle.


Source: oracle

Leave a Reply