Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added 02_assignments/Assignment 1 Question 1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 02_assignments/Assignment 1 Question 2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 02_assignments/Assignment 1 Question 3 Type 1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 02_assignments/Assignment 1 Question 3 Type 2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions 02_assignments/design_a_logical_model.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Create a logical model for a small bookstore. 📚

At the minimum it should have employee, order, sales, customer, and book entities (tables). Determine sensible column and table design based on what you know about these concepts. Keep it simple, but work out sensible relationships to keep tables reasonably sized. Include a date table. There are several tools online you can use, I'd recommend [_Draw.io_](https://www.drawio.com/) or [_LucidChart_](https://www.lucidchart.com/pages/).

![Alt text](D:\Jes\Education\2024 DSI\Week 4 & 5 - SQL\Assignment\Assignment 1 Question 1.png)
## Question 2
We want to create employee shifts, splitting up the day into morning and evening. Add this to the ERD.

Expand All @@ -17,14 +18,26 @@ Bonus: Are there privacy implications to this, why or why not?
```
Your answer...
```
Type 1 will overwrite existing customer address with new updates, while type 2 will keep record of all historical addresses and add new rows when a new address is added.

For Type 1 table, these columns will exist: customer_id, customer_address, entry_date
For Type 2 table, these columns will exist: customer_id, entry_date, end_date, customer_address

For Type 1 table, when a new customer_id address is added, a new row will be written with that customer's id, address and entry_date of the date of entry. If an existing client wants to update their address, existing customer information will be overwritten where the new address will be stored in customer_address and entry_date will change to date of entry.

For Type 2 table, when any customer address is added, a new row of data is added to the table where the entry date is the date of entry and end date will be null. If the customer had a pre existing address in the database, fill the end date of the prior address as the date of the new address entry.
When an order is entered, the order entry date should reference the customer table to check for address entry where the order entry date is between entry_date and end_date.

In terms of privacy implications, user access to the data will need to be controlled to control who can access the data and also track who is accessing the data when to verify if client data is being accessed for appropriate business reasons.
## Question 4
Review the AdventureWorks Schema [here](https://i.stack.imgur.com/LMu4W.gif)

Highlight at least two differences between it and your ERD. Would you change anything in yours?
```
Your answer...
```
1. They created different schemas to organize related tables into different groups and used colours to represent each schema.
2. Identified which columns of each tables are primary keys and foreign keys

# Criteria

Expand Down