adding month to EndDate as constraint in Oracle SQL
Posted
by
user2900611
on Stack Overflow
See other posts from Stack Overflow
or by user2900611
Published on 2013-10-29T15:33:42Z
Indexed on
2013/10/29
15:54 UTC
Read the original article
Hit count: 169
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) ) );
© Stack Overflow or respective owner