adding month to EndDate as constraint in Oracle SQL
- by user2900611
I've a question regarding Oracle database SQL.
my employee each have a project, the end date of the project depends on the no of months that was given to them base on PTerm. Am i right to do it this way?
CREATE TABLE PROJECT ( P_ID VARCHAR ( 20 ) NOT NULL,
PNAME VARCHAR ( 100 ) NOT NULL,
PTERM VARCHAR ( 20 ),
PSTARTDATE DATE,
PENDDATE DATE,
CONSTRAINT PROJECT_PKEY PRIMARY KEY ( P_ID ),
CONSTRAINT PROJECT_PTERM CHECK
( PTERM IN ('1 MONTH', '2 MONTH', '3 MONTH') ),
CONSTRAINT PROJECT_ENDDATE CHECK
( PENDDATE = (PSTARTDATE + PTERM) ) );