sql - integrity constraint check to make sure employee over age 18 -


i creating table address employee data , add constraint employee table people under 18 not hired.

 create table employee  (emp_num    char(4),   emp_last   varchar2(20),   emp_first  varchar2(20),    dob        date not null,   hire_date  date default sysdate,  constraint  employee_empnum_pk primary key(emp_num),  constraint  empee_superid_fk  foreign key(super_id) reference   employee(emp_num); 

i trying add check constraint not sure how can define age 18 in check constraint. have tried constraint employee_age_ck check(dob+18<= hire_date), not work.

constraint employee_age_ck check(add_months(dob,12*18) <= hire_date)


Comments

Popular posts from this blog

javascript - Create a stacked percentage column -

Optimising Firebase database by automatically overwriting data -

javascript - Angular UI-Grid customTemplate directive causing rows to load slowly/? -