DSO428 Lab 1 - Deduce Schema

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

DSO428 Fall 2018 Lab #1 – Deduce Schema

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 Matching Primary Key ON UPDATE ON DELETE
SportCategory CategoryID - - - -
SportColor ColorDescription - - - -
SportCustomer CustomerID - - - -
SportCustomer - StateAbbreviation StateAbbreviation in NO ACTION NO ACTION
SportState
SportDepartment DepartmentID - -
SportEmployee EmployeeID
SportEmployee - DepartmentID DepartmentID in
SportsDepartment
SportInventory InventoryID - -
SportInventory - CategoryID CategoryID in
SportCategory
SportInventory - SubCategoryID SubCategoryID in
SportSubCategory
SportInventory - SupplierID SupplierID in
SportSupplier
SportOrder OrderID - -
SportOrder - CustomerID CustomerID in
SportCustomer
SportOrder - EmployeeID EmployeeID in
SportEmployee
SportOrder - PaymentType PaymentType in
SportPaymentType
SportOrderDetail (OrderID,Invento - -
ryID)
SportOrderDetail - InventoryID InventoryID in
SportInventory
SportPaymentType PaymentType - -
SportState StateAbbreviation - -
SportSubCategory SubCategoryID - -
SportSubCategory - CategoryID CategoryID in
SportCategory
SportSupplier SupplierID - -
SportSupplier - StateAbbreviation StateAbbreviation in
SportState

You might also like