Professional Documents
Culture Documents
Lab Chapter # 1 KOVID BEHL - N01579154 - ITC-5104-0NA
Lab Chapter # 1 KOVID BEHL - N01579154 - ITC-5104-0NA
: N01579154
ITC-5104-0NA
Lab Chapter # 1
Total Marks: 10
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.
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
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.
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# COFFEE TYPE
CUSTOMER NAME ITEM#
ORDER DATE SUPPLIER#
PHONE NO. ORDER#
SHIP DATE
ADDRESS COFFEE TYPE
SUPPLIER
SUPPLIER#
SUPPLIER NAME
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:
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 TABLE
Course
Instructor Name Course venue
Code
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