You are on page 1of 6

NAME: Kovid Behl STUDENT NO.

: N01579154

ITC-5104-0NA

Lab Chapter # 1
Total Marks: 10

DO NOT ZIP THE FILE, JUST SEND AS A WORD OR PDF DOCUMENT


THROUGH BLACKBOARD I WILL NOT ACCEPT SUBMISSION
THROUGH EMAIL.

Answer the questions on the following page by referring to below ER Diagram.


Hands-On Assignments

1. Which tables and fields would you access to determine which book titles have been
purchased by a customer and when the order shipped?
Tables: Orders, Order Items, Books
Fields: Customer#, Order#, Ship date, Item#, ISBN, Title
To determine which book titles have been purchased we need ISBN and Book Title from the
Book table and for getting when the order is shipped, we need Order#, Customer#, Ship date
from the Orders table we also need Order items table which connect the two tables.

2. How would you determine which orders have not yet been shipped to the customer?
Tables: Customers, Orders
Fields: Customer#, Order#, Ship date
If Ship date is Null, the order has not yet been shipped.

3. If management needed to determine which book category generated the most sales
in April 2009, which tables and fields would they consult to derive this information?
Tables: Books, Order items, Orders
Fields: Order#, Order date, Item#, ISBN, Quantity, Category
We need Order date to know if purchase was made before April 2009. Then Quantity would tell
us which book is sold how many times. We would link this with category to see which books
with same category has been sold the most.

4. Explain how you would determine how much profit was generated from orders
placed in April 2009.
Tables: Orders, Order Items, Books
Fields: Order#, Order date, Item#, ISBN, Quantity, Paid each, Cost
If we subtract the Cost from Books table with Paid each from Order items table, we will get the
Profit generated from each item sold now we can multiply it with the quantity to get the profit for
that order item, we will do the same for all the orders and take only those orders with shipment
date lying in April 2009. By adding all the profits together, we can determine how much profit
was generated in April 2009.

5. If a customer inquired about a book written in 2003 by an author named


Thompson, which access path (tables and fields) would you need to follow to find the
list of books meeting the customer’s request?
Tables: Books, Book author, Author
Fields: ISBN, Title, Pubdate, AuthorID, Lname, Fname
We can look for the name Thompson in Fname and Lname to get his AuthorID, then we can use
this AuthorID to get all the ISBNs linked with it, then we can take those ISBNs look for which
all are published in 2003 using pubdate. Finally, we would get all the list of book titles written by
Thompson in 2003.
In questions 6 to 10, create a simple E-R model depicting entities and relationship lines
for each data scenario.

6. A college needs to track placement test scores for all incoming students. Each
student can take a variety of tests, including English and math. Some students are
required to take placement tests because of previous coursework.
COURSES STUDENT SCORES

COURSE# STUDENT#
COURSE NAME COURSE#
STUDENT NAME
COURSE NAME
isTestRequired
SCORE

7. Every employee in a company is assigned to one department. Every department can


contain many employees.
DEPARTMENT EMPLOYEE

EMPLOYEE#
DEPARTMENT# DEPARTMENT#
DEPARTMENT NAME EMPLOYEE NAME
DESIGNATION

8. A movie megaplex needs to collect and analyze movie attendance data. The
company maintains 16 theaters in a single location. Each movie offered can be
shown in one or more of the available theaters and is typically scheduled for three to
six showings in a day. The movies are rotated through the theaters to ensure that
each is shown in one of the stadium-seating theaters at least once.
MOVIE THEATRE ATTENDANCE THEATRE

THEATRE# THEATRE#
MOVIE#
MOVIE# THEATRE TYPE
MOVIE NAME
ATTENDANCE THEATRE NAME
9. An online retailer of coffee beans maintains a long list of unique coffee flavors. The
company purchases beans from several suppliers; however, each specific flavor of
coffee is purchased from only a single supplier. Many of the customers are repeat
purchasers and typically order at least five flavors of beans in each order.

ORDER COFFEE
CUSTOMER ORDER ITEMS

ORDER#
CUSTOMER# CUSTOMER#
CUSTOMER NAME COFFEE TYPE
ORDER DATE ITEM# SUPPLIER#
PHONE NO. SHIP DATE ORDER#
ADDRESS COFFEE TYPE

10. Data for an information technology conference needs to be collected. The


conference has a variety of sessions scheduled over a two-day period.SUPPLIER
All attendees

SUPPLIER#
SUPPLIER NAME

SESSION ATTENDANCE SPEAKER


ATTENDEE

ATTENDEE# SESSION# SPEAKER#


ATTENDEE NAME ATTENDEE# SESSION#
EMAIL SPEAKER NAME
PHONE NO.

must register for the sessions they plan to attend. Some speakers are presenting only
one session, whereas others are handling multiple sessions. Each session has only
one speaker.
SESSION

SESSION#
TOPIC
VENNUE
Normalization & ERD
Assume that you are supposed to store the details of courses and instructors in a
university. Here is what a sample database could look like:

Course Instructor’s phone Student


Course venue Instructor Name
Code number name

CS101 Lecture Hall 20 Prof. George +1 6514821924 Rajat

CS152 Lecture Hall 21 Prof. Atkins +1 6519272918 Rahul

CS101 Lecture Hall 20 Prof. George +1 6514821924 Raman

CS154 CS Auditorium Prof. George +1 6514821924 Rahul

Here, the data basically maintained about the following entities:


a) courses
b) course offerings
c) students and
d) instructors

At first, this design seems to be good. However, issues start to develop once we need to modify
information. For instance, suppose, if Prof. George changed his mobile number. In such a
situation, we will have to make edits in 2 places. What if someone just edited the mobile number
against CS101, but forgot to edit it for CS154? This will lead to stale/wrong information in the
database.
1) Create list of the tables you have identified at each step of the normalization process (that
is, 1NF, 2NF, 3NF) and the attributes, or fields, in each table. Remember that each
instructor can teach more than one course, each course can be taken by more than one
student.
2) Construct an E-R diagram for the same and document all assumptions that you make
about the mapping constraints.

1)

1NF

Course Instructor’s phone


Instructor Name Student name Course venue
Code number

CS101 Prof. George Rajat Lecture Hall 20 +1 6514821924

CS152 Prof. Atkins Rahul Lecture Hall 21 +1 6519272918

CS101 Prof. George Raman Lecture Hall 20 +1 6514821924

CS154 Prof. George Rahul CS Auditorium +1 6514821924


Primary key is composite key including Course Code Instructors Name and Student Name
2NF

COURSE TABLE
Course
Instructor Name Course venue
Code

CS101 Prof. George Lecture Hall 20

CS152 Prof. Atkins Lecture Hall 21

CS154 Prof. George CS Auditorium

INSTRUCTOR TABLE
Instructor’s phone
Instructor Name
number
Prof. George +1 6514821924
Prof. Atkins +1 6519272918

STUDENT TABLE
Student name Course Code
Rajat CS101
Rahul CS152
Raman CS101
Rahul CS154
There are no partial dependencies, and the tables are divided into 3 tables, where course code is
the primary key for course table, instructor name is the primary key for the instructor table and
student name + course code composite key for student table.

3NF
Tables are already in 3NF as there are no transitive dependencies.

2)
COURSES
INSTRUCTORS
COURSE CODE
INSTRUCTOR NAME INSTRUCTOR NAME
COURSE VENNUE PHONE NO.

STUDENT

STUDENT NAME
COURSE CODE

You might also like