How can I add a check constraint in data modeller that binds values of one attribute to another? I have two attributes of date type, the entity being the course, one is for start date, the second for end date and check is to assure end date is not lesser than start date. I want to apply that on a relational model.
To be more specific, the entity in question translates itself into the following sql code in the script generated by the Data Modeller:
create table COURSE_EDITION ( COURSE_ID VARCHAR2 (10 CHAR) NOT NULL, EDITION_ID VARCHAR2 (10 CHAR) NOT NULL, NAME VARCHAR2 (80 CHAR) NOT NULL, START_DATE DATE NOT NULL, END_DATE DATE NOT NULL, DESCRIPTION VARCHAR2 (1000 CHAR) ) ;
And the problem I mention was worked around by adding to that script manually:
alter table COURSE_EDITION add constraint CK_END_DATE check ( START_DATE <= END_DATE ) ;
My question is did I really have to add it to the generated code on my own? To my understanding it should be done somewhere in the model and that in turn be translated into sql code for me automatically.