Entity/Relationship Model → Relational Schema
One-to-many Relationship, with attributes
- Relationship → Table.
- Relationship attribute → Column.
- Each participant's primary key is a component of the relationship's table's primary key.
- Each participant's primary key becomes a foreign key in the relationship's table.
 |
create table Department(
dept_id int not null primary key,
location varchar not null,
...
);
create table Employee(
emp_id int not null primary key,
name varchar not null,
...
);
create table Works(
dept_id int not null references Department,
emp_id int not null references Employee,
started date not null,
primary key(dept_id, emp_id)
);
|
|