SQLRef Schema Explanation

Most of our examples use the same schema, which represents a system a landlord might use to track rent payments. The system has three tables:

Sometimes we add an extra column to make an example more clear.

Table examples

tenants

id name
1 Albert
2 Marie
3 Jose
4 Terrell

buildings

id address
1 123 Main St
2 2 Maple St

rent_payments

id tenant_id building_id payment_date dollar_amount
1 1 1 3/1/2018 2000
2 2 1 3/2/2018 1500
3 3 2 3/1/2018 1800
4 4 2 3/3/2018 1900
5 1 1 4/2/2018 2000
6 2 1 4/2/2018 1500
7 3 2 4/1/2018 1800
8 4 2 4/2/2018 1900