59 lines
2.2 KiB
Markdown
59 lines
2.2 KiB
Markdown
## Schema Designer
|
|
|
|
Time to learn about databases. Take a look at this [database schema designer](http://ondras.zarovi.cz/sql/demo/). We're going to design databases with it. Lots of them.
|
|
For this assignment, design databases that model the following relationships. Once you're done modeling them, take a screen shot of your schema and put it in the pics folder. Please name the pics to reflect which database they model.
|
|
|
|
#### Snacks
|
|
|
|
Usha downstairs needs some help with her database of snacks.
|
|
|
|
A snack has a brand name, a type (ie. candy, cake), a price, and an available quantity.
|
|
|
|
#### Family Tree
|
|
|
|
Create a table / tables to hold your family tree.
|
|
|
|
#### Students and Teachers
|
|
|
|
Help a school organize their scheduling system.
|
|
|
|
- A class has many students.
|
|
- A student has many classes.
|
|
- A teacher has many classes.
|
|
- A class can have many teachers.
|
|
|
|
#### Employees
|
|
|
|
A company's HR department needs to store their employee roster.
|
|
|
|
Employees are identified by ssn, with salary and phone number as attributes.
|
|
|
|
Departments are identified by department id, with name and budget as attributes.
|
|
|
|
A department has many employees.
|
|
|
|
#### Subreddit
|
|
|
|
Model a reddit subreddit. Go on [reddit](http://www.reddit.com) and look at what data a subreddit holds.
|
|
|
|
We know that users can perform the following actions:
|
|
|
|
- Subscribe to a subreddit
|
|
- Submit a post
|
|
- Submit a comment
|
|
- Upvote or Downvote a post
|
|
|
|
#### Art Gallery
|
|
|
|
An art gallery needs to upgrade their systems.
|
|
|
|
Galleries keep information about artists, their names (which are unique), birthplaces, age, and style of art.
|
|
|
|
For each piece of artwork, the artist, the year it was made, its unique title, its type of art (e.g., painting, lithograph, sculpture, photograph), and its price must be stored.
|
|
|
|
Pieces of artwork are also classified into groups of various kinds, for example, portraits, still lifes, works by Picasso, or works of the 19th century; a given piece may belong to more than one group.
|
|
|
|
You don't have to model exactly this. Think about what your art gallery is going to sell and it's interaction with customers.
|
|
|
|
Model what you think the database needs for the beginning of the business, and build the model so that it has room to grow into its future needs.
|