Skip to content

Commit e1af98e

Browse files
authored
fix(curriculum): remove product column in 2NF lesson (freeCodeCamp#63786)
1 parent 958fb2b commit e1af98e

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

curriculum/challenges/english/blocks/lecture-working-with-sql/68816f386bc30d36f59e9563.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ The Second Normal Form (2NF) is based on addressing partial dependencies. A part
5959
For example, let's say we have an `orders` table with these columns:
6060

6161
```sql
62-
order_id | item_id | order_date | product | quantity | order_shipping_city
62+
order_id | item_id | order_date | quantity | order_shipping_city
6363
```
6464

6565
In this table, the primary key is the combination of `order_id` and `item_id` because the same item ID can be in different orders, but their combination will be unique. You can see that there is a partial dependency between `order_id` and `order_shipping_city`. `order_id` is part of the primary key. `order_shipping_city` depends on `order_id` because every order with the same ID will have the same shipping city. However, the shipping city does not depend on the `item_id`, but this is also part of the primary key. Therefore, `order_shipping_city` does not depend on the entire primary key.
@@ -73,7 +73,7 @@ order_id | order_date | order_shipping_city
7373
In the `order_items` table, you could store information about the items in the different orders that were submitted:
7474

7575
```sql
76-
order_id | item_id | product | quantity
76+
order_id | item_id | quantity
7777
```
7878

7979
With these changes, both tables will be in Second Normal Form (2NF).
@@ -90,7 +90,7 @@ To understand the Third Normal Form (3NF), you need to understand transitive dep
9090
For example, let's modify our `orders` table to have these columns:
9191

9292
```sql
93-
order_id | customer_id | customer_city | city_postal_code | order_date | product | quantity
93+
order_id | customer_id | customer_city | city_postal_code | order_date | quantity
9494
```
9595

9696
The primary key in this new table is `order_id` because it uniquely identifies each row.
@@ -106,7 +106,7 @@ The city's postal code is determined by the customer's city, which is determined
106106
To solve the transitive dependency, you would need to split the table into multiple tables. First, an `orders` table:
107107

108108
```sql
109-
order_id | customer_id | order_date | product | quantity
109+
order_id | customer_id | order_date | quantity
110110
```
111111

112112
Then, a `customers` table:

0 commit comments

Comments
 (0)