Bootcamp
Search…
3.ICE.11: DB Schema Design - Uber

Introduction

Design a database schema for Uber. Uber is like Grab, but just for rides.

Base

ERD

Create a DB schema for Uber by drawing an ERD for the DB, starting with only essentials for Uber's ride functionality. The real Uber 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.
Food for thought: Do we need separate rider and driver tables, or can we use a single user table to represent both riders and drivers? What are the pros and cons of each configuration?

DB Setup

Create a new local database called uber.

CREATE TABLE Statements

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 a given page on Uber, for example this screen:
Don't worry about INSERT or UPDATE queries, or queries for searches. Record the SELECT statements in a file queries.sql.

More Comfortable

Add tables and columns for additional Uber features and repeat Base instructions.