POTD 2: SQL — Candy Inventory

Due 13-Feb-2024, 12pm/noon EST

Purpose:


Part 1: Get started

You have ~5 minutes to complete the following tasks.
  1. Team with 5-6 of your neighbors
  2. Get to know your team. Using the two-breath rule, introduce yourself, share your name, major(s), the year you are in.
  3. Please send one of the team members to grab a hand full of candies. Your team will create table(s) to maintain your candy inventory. Please don't eat yet. You may have your candies after class.

Part 2: (small scale) DB design

You have ~15 minutes to complete the following tasks.

Imagine, you are designing a small (partial) candy inventory.

Consider your candy inventory.

  1. Discuss in your team. Come up with a partial E-R diagram (1-2 entity sets, and a relationship set if applicable) to help you manage your candy inventory.
    • Although we are imitating an inventory scenario, due to the time limitation, we will focus on managing some parts of the candy inventory.
    • You should consider only the information necessary to be maintained in your candy database.
  2. Transform the E-R diagram into table(s).
  3. List all functional dependencies (FDs) that are applicable.
  4. Decompose your table(s) using either 3NF or BCNF. For each table, if it is already in the chosen normal form, discuss in your team and make a note to show that it is already in the chosen normal form.

Part 3: (small scale) DB implementation

You have ~20 minutes to complete the following tasks.
  1. Write SQL to create your candy database
  2. Write SQL to create the table(s) you designed in part 2. Be sure to include constraints such as primary key(s) and foreign key(s).
  3. [Consider your candy inventory, get all information to be maintained in your database] — Write SQL to insert data into your table(s)
  4. Write SQL to retrieve data from your database.
    • To help you practice, you should come up with some (simple) questions and then write SQL to answer the questions.
    • Try to keep your questions simple (for now). We will discuss additional operations (such as aggregation function and join) and you will solve more complicated queries later.
  5. [Exchange a few (or some, or a lot of) candies with another team (or as many teams as you'd prefer)] — Write SQL to update data in your database. For example, you may need to update the quantity available in your inventory. You may need to insert a new item into your inventory. You may need to delete the entire information about some candies if you no longer wish to maintain them in your inventory.

Part 4: Final step

You have ~5 minutes to complete the following tasks.
  1. [Imagine your company has decided to close the inventory. Each team member will take some candies home. Be sure that no candy is left in the classroom] — Write SQL to remove all information from your table(s).
  2. Write SQL to drop your table(s)
  3. Write SQL to drop your database

What to submit


Grading rubric

[Total: 10 points]: Done (or provide evidence of your attempt, full or reasonable effort)

(-2.5 points) for 24 hours late (submitted after 13-Feb-2024 12pm EST, by 14-Feb-2024 12pm EST)
(-5 points) for 48 hours late (submitted after 14-Feb-2024 12pm EST, by 15-Feb-2024 12pm EST)


Submission



Copyright © 2024 Upsorn Praphamontripong
Released under the Creative Commons License CC-BY-NC-SA 4.0 license.
Last updated 2024-02-07 20:04