Relational Database Cardinality (How is it expressed)
Posted on 1998-11-13
I am trying to understand how cardinality is expressed in a relational database schema as opposed to a schema which is object oriented.
For instance, when creating a few tables(relational) for a bus company where the corprate office table has a relation with branch offices table, how can the one to many relation be expressed? Here are the two tables:
create table XYZ_Bus_Company --Corp. Office
Branch_Name varchar(20)not null,
Employee_SSN char(9)not null,
primary key(Branch_Name, Employee_SSN),
foreign key(Branch_Name) references(Branch_Offices),
foreign key(Employee_SSN) references(Employee)
create table Branch_Offices
The XYZ Bus Co. has many branches but the Branch Office table has only one corprate office. With the attributes I have above, how does the Branch_Offices table relate to the corprate office?
In other words, what field/attribute do I need to add to complete the relation? I want to add the following line to the Branch_Offices table but I don't know if it would be the best way because the field would be somewhat redundant in each tuple:
Corp_Office char(11), --XYZ Company