Assignment 3

What to Do

  1. Open this Google Doc.
  2. Make a copy of the Google Doc in your own Google account by choosing File → Make a Copy.
  3. Answer each of the questions below in the Google Doc by filling in the blanks marked TODO. Your answers, if not code, should be no more than a few sentences in length each.

Questions

  1. What does it mean for a database to be “relational”?

  2. What problems are solved by storing data across multiple tables, rather than storing all of the data in a single table?

  3. What’s a problem that’s created by storing data across multiple tables, rather than storing all of the data in a single table?

  4. What’s the difference between a primary key and a foreign key?

  5. What does it mean to create an index on a column in a database table? And why would you do it?

SQL

Download and install DB Browser from https://sqlitebrowser.org/ if you don’t have it already. If using a Mac and informed that it “cannot be opened because the developer cannot be verified,” see support.apple.com/en-us/HT202491; if using a PC, odds are you’ll want the Standard installer for 64-bit Windows.

Download shows.db if you don’t have it already.

Open the latter with the former and use SQL (not, e.g., Google) to solve the problems below.

  1. How many actors have a first name of Meryl? Via which SQL query or queries did you determine your answer?

  2. How many shows have been made about the Titanic? Via which SQL query or queries did you determine your answer? And why might your answer not be accurate?

  3. How many shows debuted in 2019? Via which SQL query or queries did you determine your answer?

  4. How many episodes of “Law & Order” (the original, not spin-offs) were there? Via which SQL query or queries did you determine your answer?

  5. How many game shows (not episodes thereof) have been produced? Via which SQL query or queries did you determine your answer?

  6. Which show has the most episodes? Via which SQL query or queries did you determine your answer?

Debrief

  1. About how many MINUTES would you say you spent on this assignment? Just to set expectations for future students.

How to Submit

  1. Download your completed assignment as a PDF by choosing File → Download → PDF Document, and save it to your computer.
  2. Go to CS50 for JDs’s Gradescope page.
  3. Click Assignment 3.
  4. Click Submit PDF.
  5. Click Select PDF and choose your assignment file.
  6. Click Upload PDF.
  7. Click the first question in the Question Outline at left, then click the page (or pages) on which your response to that question is located. Repeat this process for the remaining questions.
  8. Click Submit.

You should see a message that says “Assignment 3 submitted successfully!”

If you run into any trouble with the above steps, email hls@cs50.harvard.edu!