Re: problem with referential integrity notation in SQL (and in ER diagrams?)
Date: Tue, 11 Oct 1994 13:41:58 GMT
Message-ID: <jreinert.781882918_at_rhein>
l.carl.pedersen_at_dartmouth.edu (L. Carl Pedersen) writes:
>suppose i have a student loan system that allows certain types of loans
>create table student
> ( student_id number primary key,
> student_type_id number references student_type,
> name..., ssn... etc. );
>create table student_type
> ( student_type_id number primary key,
> student_type_description.... etc.)
>create table loan
> ( loan_id number primary key,
> loan_type_id number references loan_type,
> interest_rate... etc.);
>create table loan_type
> ( loan_type_id number primary key,
> loan_type_description.... etc.)
>create table student_loan
> ( student_id number references student,
> loan_id number references loan,
> amount... etc. );
>STUDENT_LOAN tells which loans are held by which students, but what about
>our type restriction saying that only certain types of loans are allowed
>to certain types of students? makes sense to make another table for this:
>create table type_pair
> ( student_type_id number references student_type,
> loan_type_id number references loan_type,
> primary key(student_type_id,loan_type_id) );
Hope this helps
Joachim
-- Joachim Reinert UNI Kaiserslautern, AG-DVS fax : +49 631 205 3558 P.O. Box 3049 phone : +49 631 205 3282 67653 Kaiserslautern - Germany e-mail: jreinert_at_informatik.uni-kl.deReceived on Tue Oct 11 1994 - 14:41:58 CET