# M8 Database Design
# Intro
# Database Design Example
Note: I’m using a different diagraming tool in this video but for your assignment use drawSQL ( https://drawsql.app) like in previous weeks.
# Database Design Assignment
For this assignment, you’ll be going through the entire process of designing, creating and querying a database for a local property management company. This company manages rental properties for landlords in the greater Seattle area for a percentage of the rental income. In order to handle these properties effectively the company needs to organize and track information about their properties and tenants in a database.
Part 1 (10 pts): Create an Entity Relationship Diagram. Create an entity relationship diagram that represents the following:
- Owners have names, phone numbers and a date that they joined the management service.
- An owner can have multiple properties managed by the company and a property can have one or more owners.
- Properties have a street address and an estimated market value.
- Properties have one or more units and a unit can only belong to one property.
- Each unit has a unit number and a monthly cost.
- A unit can have many tenants, but a tenant can only be in one unit.
- Tenants have a first name, last name and email.
- A payment has a date and an amount paid. It also must track the user who made the payment and the unit that the payment was made on.
- Tenants can make maintenance requests on units. A maintenance request has a description, a severity (1-10) and a completion status (done or not done). It also must track the tenant who made the request and the unit the request was made on.
Part 2 (10 pts): Create and populate tables. Write CREATE statements for each table in your diagram. Then insert at least 2 rows of data into every table (although you may want to add more to some of the joining tables). Be sure that the relationships you establish between your tables match the design outlined in your diagram, I’m looking for consistency between your code and your ERD.
After your CREATE
and INSERT
statements, write a SELECT * FROM TableName
for each table in your database. Like so:
|
|
# Submission Instructions
For part 1 of this assignment, take a screenshot of your completed entity relationship diagram(s) from drawSQL.
For part 2 of this assignment, please put your CREATE
, INSERT
and SELECT
SQL queries into a single SQL file.
Upload the .sql file and ER diagram image to the assignment on Canvas.