Assignment: Data Modeling

Now that you’ve learned about relational databases and SQL, let’s put together what we’ve learned and create a database.

Submission Process

App Domain

The domain is similar to Instagram. You might want to read through the queries first to decide how best to store the data.

Tables & Data

Queries

After designing and creating your tables above, include SQL for the following queries

Creating/Updating Data

  1. Insert a new user that is joining the platform
  2. Insert record that a user uploaded a photo of a given url
  3. Update the database to record that a user Heart’ed a specific photo

Reading Data

  1. Select all columns from the photo table that were uploaded by one user (given their primary key)
  2. Select the image URLs of all Photos that a specific User ID Hearted
  3. Select all the usernames who Hearted a given photo (given the photo’s primary key)

End of Requirements

If you have completed the above, or the due date has arrived, please submit according to instructions above. If you want more challenges, please continue.

Bonus Queries

  1. Find the user with the most Hearts across all their photos
  2. Find the single most recently added photo of one user (given their username)
  3. Find the photo with the most Hearts

Bonus