Grey Rooming House Print This

You might also like

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 26

Database Design

How to Normalize
Grey’s Rooming House

Continue to next slide


Assignment Instructions
• You may work alone or in groups of 2 or 3. No more than 3.
• EVERY student, individually, must download and save this powerpoint file,
complete the instructions, save and submit their own updated file in the Canvas
link.
• Go through this slide deck ONE slide at a time. If you skip ahead or do not
actually work to solve the problem, you will not learn normalization and later
assignments will be difficult.
• You must complete the “Student Input Needed” text boxes by answering the
questions. DON’T skip slides.
• Have your normalization guide handy.
• Review the rubric for this assignment.
• Post any questions you have in the normalization channel.

Continue to next slide


Student Information
Student Input Needed:
Who is working on this assignment? Type all names in
this text box.
Type names here:

Continue to next slide


Case Information
Information Booth Activity I
Dear Professor Sanchez,
I have been asked to finish a database project that I began last year. Because I will be traveling so much with my new job, I won't have time to complete it. I
hope some of your students might be able to help me. Here are the details.
Mrs. Grey owns a rooming house in College Town, Missouri. Students' visitors often stay at Mrs. Grey's because it is cheap, clean, and almost always
available. Students attending the university often spend a few weeks at Mrs. Grey's before finding permanent accommodations. The rooming house has seven
rooms, some of which are double rooms, i.e., have two twin beds, and some are single rooms. In addition, some rooms have a bathroom. When I stayed at
Mrs. Grey's Rooming House, I convinced her that instead of paying my rent, I could develop an Access database system for her to streamline her operation. I
started the project but then was so busy with final exams and job-hunting that I couldn't finish the database. Mrs. Grey has called me to complete the database
system-or else find someone who could.
The database management system will be used to do the following:
• Keep track of customers and their permanent address.
• Keep track of the rooms in the house and their room type.
• List the price of each room type.
• Record the length of a stay in a specific room by a customer.
• Rank the popularity of each room.
• Generate monthly bills for customers.
In addition to having these tables, Mrs. Grey requested two reports: the first report should show her how often each type of room is rented, with the most
popular room being noted first, sorted to the least popular. Next, she would like a report from which she can generate her occupants' end-of-month bills. This
report should include the occupant's name, address, date first rented, and total amount due.
I hope some of your students can help me with this project. Thank you. Yours truly, Amy Patterson

Continue to next slide


Attributes of Interest
cust_id, custfname, custlname, custadd, custstreet, custcity, custstate,
custzip, custphone, roomno, roomtype, bathroom (y/n), price, date_in,
date_out, custpaydate, payamount

Additional Information and assumptions:


The price of the room is based on the room type.
A room only has one type.
There is no in and out on the same day. In other words, a room is rented per day.
Notes:
There are multiple solutions for this information. That said, after attributes and
dependencies are determined, there is only one correct normalization solution.
This solution meets all requirements and is very simple.

Continue to next slide


What are the dependencies?
Assignment
• Draw a dependency diagram in graphic or list form.
• In list form, remember every attribute can determine itself.
• You may do so on a piece of paper. You do not have to submit
it. Don’t worry if you miss some, it takes a lot of practice!
• Do NOT click to the next slide until you have completed the
dependencies.

Continue to next slide


Dependency Diagram-List
cust_id determines cust_id, custfname, custlname,
custadd, custstreet, custcity, custstate, custzip,
custphone
room_no determines room_no, room_type, bathroom,
price
room_type determines room_type, price
cust_id, room_no, date_in determines cust_id, room_no,
date_in, date_out
cust_id, custpaydate determines cust_id, custppaydate,
payamount
Continue to next slide
Dependency Diagram-Graphic

cust_id custfname custlname custadd custstreet custcity custstate custzip custphone roomno roomtype bathroom (y/n) price date_in date_out custpaydate payamount

Continue to next slide


Reflection-Dependencies
Student Input Needed:
Compare your dependency diagram to the ones created.
Below write a short reflection. Note any questions you
have about the solution and post them in the
communication room channel.
Type your reflection here:

Continue to next slide


1 NF
No repeating groups
Table/Set format
Primary key identified

Assignment:
• Create the 1NF table in graphic or list form.
• You may do so on a piece of paper. You do not have to submit it. Don’t worry if you don’t’
get it correct, it takes a lot of practice!
• Do NOT click to the next slide until you have completed the 1NF table

Continue to next slide


1 NF Solution
{cust_id, custfname, custlname, custadd, custstreet, custcity, custstate, custzip, custphone, roomno,
roomtype, bathroom (y/n), price, date_in, date_out, custpaydate, payamount}

cust_id custfname custlname custadd custstreet custcity custstate custzip custphone roomno roomtype bathroom (y/n) price date_in date_out custpaydate payamount

Note: cust_id, roomno, date_in, and custpaydate do not have any arrows pointing in at them

Continue to next slide


Reflection-1NF
Student Input Needed:
Compare your 1NF table to the solution. Below write a
short reflection. How did you do? What did you get
wrong? Why? How can you avoid this mistake in the
future?
Type your reflection here:

Continue to next slide


2 NF
1NF
No repeating groups
Table/Set format
Primary key identified
No partial dependencies

Assignment:
• Create the 2NF tables in graphic or list form.
• You may do so on a piece of paper. You do not have to submit it. Don’t worry if
you don’t’ get it correct, it takes a lot of practice!
• Do NOT click to the next slide until you have completed the 2NF tables

Continue to next slide


2 NF Solution
{cust_id, custfname, custlname, custadd, custstreet, custcity, custstate, custzip, custphone}
{roomno, roomtype, bathroom, price}
{cust_id, roomno, date_in, date_out}
{cust_id, custpaydate, payamount}

cust_id custfname custlname custadd custstreet custcity custstate custzip custphone

roomno roomtype bathroom price

cust_id custpaydate payamount cust_id roomno date_in date_out

Continue to next slide


Reflection-2NF
Student Input Needed:
Compare your 2NF tables to the solution. Below write a
short reflection. How did you do? What did you get
wrong? Why? How can you avoid this mistake in the
future?
Type your reflection here:

Continue to next slide


3 NF
1NF
No repeating groups
Table/Set format
Primary key identified
2NF
No partial dependencies
No transitive dependencies

Assignment:
• Create the 3NF tables in graphic or list form.
• You may do so on a piece of paper. You do not have to submit it. Don’t worry if you don’t’ get
it correct, it takes a lot of practice!
• Do NOT click to the next slide until you have completed the 3NF tables

Continue to next slide


3 NF Solution
{cust_id, custfname, custlname, custadd, custstreet, custcity, custstate, custzip, custphone}
{roomno, roomtype, bathroom}
{roomtype, price}
{cust_id, roomno, date_in, date_out}
{cust_id, custpaydate, payamount}

cust_id custfname custlname custadd custstreet custcity custstate custzip custphone

roomno roomtype bathroom roomtype


roomtype price

cust_id custpaydate payamount cust_id roomno date_in date_out

Continue to next slide


Reflection-3NF
Student Input Needed:
Compare your 3NF tables to the solution. Below write a
short reflection. How did you do? What did you get
wrong? Why? How can you avoid this mistake in the
future?
Type your reflection here:

Continue to next slide


Entity or Relationship (CR)
{cust_id, custfname, custlname, custadd, custstreet, custcity, custstate, custzip, custphone}
{roomno, roomtype, bathroom}
{roomtype, price}
{cust_id, roomno, date_in, date_out}
{cust_id, custpaydate, payamount}

• Name the tables something that describes the attributes. If the key attributes consist of two or
more attributes that individually are foreign keys to another table then the table is a composite
relationship, otherwise the table is an entity.
• You may do so on a piece of paper. You do not have to submit it. Don’t worry if you don’t’ get it correct, it
takes a lot of practice!
• Do NOT click to the next slide until you have named and identified the tables

Continue to next slide


Table Names Solution
{cust_id, custfname, custlname, custadd, custstreet, custcity, custstate, custzip, custphone} E CUSTOMER
{roomno, roomtype, bathroom} E ROOM
{roomtype, price} E PRICE
{cust_id, roomno, date_in, date_out} R Rent
{cust_id, custpaydate, payamount} E BILL

We know that Rent is a composite relationship because it meets BOTH rules: 1) more
than ONE key attribute 2) At least two are primary keys in other tables.
Why is BILL not a CR?

Continue to next slide


Reflection-Tables
Student Input Needed:
Compare your table identity and names to the solution.
Below write a short reflection. How did you do? Your
names may be slightly different and still be correct but
entity should be singular name and relationship should be
verb. Why is BILL not a composite relationship?
Type your reflection here:

Continue to next slide


ER Diagram
• Use Visio to draw an ER and RS in Chen Notation with cardinality OR
• Use Visio to draw an ER diagram with Crow’s Foot notation.
• You do not have to submit it. Don’t worry if you don’t’ get it correct, it
takes a lot of practice!

Do NOT click to the next slide until you have named and identified the
tables

Continue to next slide


ER Diagram Solution-Chen

ER Diagram Relational Schema


CUSTOMERS RENT ROOM
1 m m 1
CUSTOMER ROOM cust_id
Rent
custfname
custlname cust_id roomno
custadd room_no roomtype
1 m
custstreet date_in bathroom
custcity date_out
custstate
cuszip
Pay Have custphone

m 1

BILL PRICE
BILL PRICE

cust_id
roomtype
custpaydate
price
payamount

Continue to next slide


ER Solution-Crow’s Foot
CUSTOMER Rent ROOM

PK cus_id int PK cust_id int PK roomno int

custfname int PK roomno int roomtype int

custlname int PK date_in int bathroom int

custadd int date_out int

custstreet int

PRICE
custcity int

PK roomtype int
custstate int

price int
cuszip int

custphone int

BILL

PK cus_id int

PK cuspaydate int

payamount int

Continue to next slide


Reflection-ER Diagrams
Student Input Needed:
Compare your ER diagrams to the solution. Below write a
short reflection. How did you do? What did you get
wrong? Did you check your cardinality? Why? How can
you avoid this mistake in the future?
Type your reflection here:
Submission

• Save this PowerPoint Presentation with your information and reflections.


• Submit this ONE PPT in the Canvas assignment link.
• Make a list of the questions you have and post them in the normalization
channel of the class communication chat so they can be answered for everyone.
• Every student must save and submit their own updated file!

• Great Job!!

You might also like