Lab 1
Lab 1
Lab 1
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.
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