You are on page 1of 3

DSO428 Fall2016 Lab #1 Deduce Schema

Due: 11:59pm, Fri, Sep.09


Note: The file name must be renamed to
yourLastName_yourFirstName_Lab1.docx or
yourLastName_yourFirstName_Lab1.doc.

1. Login into the database (following instructions in Lab 0 slides) and click on
SportMotors database. There are 12 tables in the SportMotors database.
After examining each table (by clicking on Select Top 1000 Rows on
each table), prepare a schema of what you think the database looks like
(tables and their relationships). For your convenience, I also include an
excel with all the 12 tables (Lab 1 tables.xlsx).
2. An example table (SportCategory) looks like the following with all rows,
columns and attribute names. Using the information of all tables, play
detective and deduce the primary key foreign key combinations for the
SportMotors database.

Lab 1 Assignment: After examining the data on various forms, fill


out the table below. It is about identifying primary keys, foreign
keys, and integrity constraints. In the second column, write the
primary key of each table. For a row you write the primary key of a
table, leave the columns 3,4,5,6 empty. For a row you write a
foreign key and its matching primary key, leave column 2 empty. A
few examples are given in the table. Add more rows as needed.
Notes: The answer for the last 2 columns on referential action is
relatively flexible. There could be more than one answer depending
on business rules in specific context (e.g. I gave an example in
lecture that No action/Cascade/Set NULL may all make sense for
branchno in Staff table). You can give more than one answer
based on your understanding of potential business rules.
TA will focus on your answer in the first 4 columns
(Table,PK,FK,Matching PK) when grading this lab (i.e. your answer

for the last 2 columns will not be graded). However, the last 2
columns on the concept of referential action are also very important
and will be in the quiz and midterm/final. Please still try it first and
check your answer when the solution for this lab is posted.
I will briefly clarify the requirement during lab. Please let TA or me
know if you have any questions. Please submit your answer on
BlackBoard before the due day.
Table

Primary Key

Foreign Key

SportCategory
SportColor
SportCustomer
SportCustomer

CategoryID
ColorDescription
CustomerID
-

SportDepartme
nt

DepartmentID

SportEmployee
SportEmployee

EmployeeID

SportInventory
SportInventory

InventoryID

StateAbbreviatio
n
-

Matching Primary
Key
StateAbbreviation in
SportState
-

ON
UPDATE
NO ACTION

DepartmentMana
gerID

EmployeeID in
SportEmployee

NO ACTION

DepartmentID

DepartmentID in
SportDepartment

CategoryID

CategoryID in
SportCategory
SubCategoryID in
SportSubCategory
SupplierID in
SportSupplier
ColorDescription in
SportColor

SportInventory

SubCategoryID

SportInventory

SupplierID

SportInventory

ColorDescription

SportOrder
SportOrder

OrderID
CustomerID

SportOrder

EmployeeID

SportOrder

PaymentType

SportOrderDetai
l
SportOrderDetai
l
SportOrderDetai
l
SportPaymentTy
pe
SportState
SportSubCatego
ry
SportSubCatego
ry
SportSupplier
SportSupplier

CustomerID in
SportCustomer
EmployeeID in
SportEmployee
PaymentType in
SportPaymentType

(OrderID,
InventoryID)

NO ACTION
NO ACTION
NO ACTION
NO ACTION

NO ACTION
NO ACTION
NO ACTION
-

ON
DELETE
NO
ACTION
NO
ACTION
NO
ACTION
NO
ACTION
NO
ACTION
NO
ACTION

NO
ACTION
NO
ACTION
NO
ACTION
-

OrderID

OrderID in
SportOrder

NO ACTION

NO
ACTION

InventoryID

InventoryID in
SportInventory

NO ACTION

PaymentType

NO
ACTION
-

StateAbbreviatio
n
SubCategoryID

NO ACTION

NO
ACTION
NO

CategoryID

CategoryID in
SportCategory

StateAbbreviatio

StateAbbreviation in

SupplierID

NO ACTION

SportState

ACTION