04.06.2015 Views

Database Modeling and Design

Database Modeling and Design

Database Modeling and Design

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

5.1 Transformation Rules <strong>and</strong> SQL Constructs 93<br />

Project<br />

Technician<br />

1<br />

1 usesnotebook<br />

1<br />

Notebook<br />

A technician uses exactly<br />

one notebook for each project.<br />

Each notebook belongs to one<br />

technician for each project. Note<br />

that a technician may still work<br />

on many projects <strong>and</strong> maintain<br />

different notebooks for different<br />

projects.<br />

create table technician (emp_id char(10),<br />

primary key (emp_id));<br />

create table project (project_name char(20),<br />

primary key (project_name));<br />

create table notebook (notebook_no integer,<br />

primary key (notebook_no));<br />

create table uses_notebook (emp_id char(10),<br />

project_name char(20),<br />

notebook_no integer not null,<br />

primary key (emp_id, project_name),<br />

foreign key (emp_id) references technician<br />

on delete cascade on update cascade,<br />

foreign key (project_name) references project<br />

on delete cascade on update cascade,<br />

foreign key (notebook_no) references notebook<br />

on delete cascade on update cascade,<br />

unique (emp_id, notebook_no),<br />

unique (project_name, notebook_no));<br />

uses_notebook<br />

emp_id project_name notebook_no<br />

35<br />

35<br />

42<br />

42<br />

81<br />

93<br />

93<br />

alpha<br />

gamma<br />

delta<br />

epsilon<br />

gamma<br />

alpha<br />

beta<br />

5001<br />

2008<br />

1004<br />

3005<br />

1007<br />

1009<br />

5001<br />

(a) One-to-one-to-one ternary relationship<br />

Functional dependencies<br />

emp_id, project_name → notebook_no<br />

emp_id, notebook_no → project_name<br />

project_name, notebook_no → emp_id<br />

Figure 5.5<br />

ER model: ternary <strong>and</strong> n-ary relationships<br />

@Spy

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!