3.ICE.12: DB Schema Design - Instagram
Instagram Account Grid View



Design a database schema for Instagram.

DB Setup

Create a new local database called instagram.


Create a DB schema for Instagram by drawing an ERD for the DB, starting with only essentials That you would need to render the grid view of an account page. (Assume you're rendering the web view of Instagram.)
The real Instagram DB would have many tables, but we don't need to include everything for this exercise. In our ERD, name the tables and columns, identify data types, and define any relationships between the tables.
Try to move as quickly as possible onto the SELECT statements you need in order to render all the data on the page.


Write and execute CREATE TABLE statements to create all tables and relationships in the ERD. Record these statements in a file init_tables.sql.

INSERT Statements

Write and execute INSERT statements to insert dummy data into the tables. Record these statements in a file seed.sql.

SELECT Statements

Write and execute sample SELECT queries you might need to render the account page above.
Don't worry about INSERT or UPDATE queries, or queries for searches. Record the SELECT statements in a file queries.sql.


Add the DB tables, inserts and queries you would need for the functionality leading to and from this page, i.e, following, clicking on the stories button, etc.

More Comfortable

Add tables and columns for additional features such as Instagram Watch or messages.