Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

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.

update:

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.

share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.