Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

ASSIGNMENT

Question 1
Consider the following relations for a database that keeps track of student enrollment in courses
and the books adopted for each course (Primary Key is mark post-fix with #):
STUDENT(SSN#, Name, Major, Bdate)
COURSE(Course#, Cname, Dept)
ENROLL(SSN, Course#, Quarter, Grade)
BOOK_ADOPTION(Course#, Quarter, Book_ISBN)
TEXT(Book_ISBN#, Book_Title, Publisher, Author)
Draw a relational schema diagram specifying the foreign keys for this schema.

Solution:

ENROLL *
SSN
Course
Quarter
Grade

STUDENT *

COURSE *

SSN

Course

Name

Cname

Major

Dept

Bdate

BOOK_ ADOPTION *
Course

TEXT *
Book_ISBN

Quarter
Book_ISBN

Book_Title
Publisher
Author

Question 2
Given the Invoice table with following initial structure (Primary Key is mark post-fix with #)

Please:
1. Normalize that table structure to the first, second and third normalization forms
2. Draw relational schema diagram for the tables defined in the third normalization form above

Solution

1. 1NF
Invoice#
1001
1001
1001
1002
1002
1003

Cust
43
43
43
55
55
43

Name
Jones
Jones
Jones
Smith
Smith
Jones

Addr
121 1st
121 1st
121 1st
222 2nd
222 2nd
121 1st

2NF
Table Invoice
Invoice#
1001
1002
1003

Cust
43
55
43

Name
Jones
Smith
Jones

Table Amount
Part#
Screw
Nut
Washr
Motor
Saw
Brace

Amt
2.00
2.25
0.75
52.00
121.00
44.44

Table Quantity
Invoice#
1001
1001
1001
1002
1002
1003
3NF
Table Invoice

Quant
200
300
100
1
10
5

Part#
Screw
Nut
Washr
Motor
Saw
Brace

Addr
121 1st
222 2nd
121 1st

Quant
200
300
100
1
10
5

Part#
Screw
Nut
Washr
Motor
Saw
Brace

Amt
2.00
2.25
0.75
52.00
121.00
44.44

Invoice#
1001
1002
1003

Cust
43
55
43

Table Customer
Cust#
43
55

Name
Jones
Smith

Addr
121 1st
222 2nd

Quant
200
300
100
1
10
5

Part#
Screw
Nut
Washr
Motor
Saw
Brace

Table Quantity
Invoice#
1001
1001
1001
1002
1002
1003
Table Amount
Part#
Screw
Nut
Washr
Motor
Saw
Brace

Amt
2.00
2.25
0.75
52.00
121.00
44.44

2. Relational Database Schema

Invoice *
Invoice
Cust

Customer *
Cust
Name
Addr

Quantity *

Amount *

Invoice

Part

Quantity

Amt

Part

You might also like