Skip to content
Open
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
120 changes: 71 additions & 49 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ Reimport the Northwind database into PostgreSQL using pgAdmin. This is the same
</details>

```SQL
SELECT contact_name, city
FROM customers
WHERE city = 'London'

```

Expand All @@ -48,6 +51,9 @@ Reimport the Northwind database into PostgreSQL using pgAdmin. This is the same
</details>

```SQL
SELECT contact_name, postal_code
FROM customers
WHERE postal_code = '1010'

```

Expand All @@ -59,9 +65,13 @@ Reimport the Northwind database into PostgreSQL using pgAdmin. This is the same
</details>

```SQL
SELECT supplier_id, phone
FROM suppliers
WHERE supplier_id = '11'

```


* [ ] ***list orders descending by the order date. The order with date 1998-05-06 should be at the top***

<details><summary>hint</summary>
Expand All @@ -70,6 +80,9 @@ Reimport the Northwind database into PostgreSQL using pgAdmin. This is the same
</details>

```SQL
SELECT *
FROM orders
ORDER BY order_date desc

```

Expand All @@ -82,6 +95,9 @@ Reimport the Northwind database into PostgreSQL using pgAdmin. This is the same
</details>

```SQL
SELECT *
FROM suppliers
WHERE length(company_name) > 20

```

Expand All @@ -95,6 +111,10 @@ Reimport the Northwind database into PostgreSQL using pgAdmin. This is the same
</details>

```SQL
SELECT *
FROM customers
WHERE UPPER(contact_title) LIKE '%MARKET%'


```

Expand All @@ -112,6 +132,8 @@ Reimport the Northwind database into PostgreSQL using pgAdmin. This is the same
</details>

```SQL
INSERT INTO customers (customer_id, company_name, contact_name, address, city, postal_code, country)
VALUES ('SHIRE', 'The Shire', 'Bilbo Baggins', '1 Hobbit-Hole', 'Bag End', '111', 'Middle Earth')

```

Expand All @@ -123,6 +145,9 @@ Reimport the Northwind database into PostgreSQL using pgAdmin. This is the same
</details>

```SQL
UPDATE customers
SET postal_code = '11122'
WHERE customer_id = 'SHIRE'

```

Expand All @@ -135,6 +160,11 @@ Reimport the Northwind database into PostgreSQL using pgAdmin. This is the same
</details>

```SQL
SELECT customer_id, company_name,
(SELECT COUNT(o.customer_id)
FROM orders o
WHERE o.customer_id = c.customer_id) as ordercount
FROM customers c

```

Expand All @@ -146,6 +176,12 @@ Reimport the Northwind database into PostgreSQL using pgAdmin. This is the same
</details>

```SQL
SELECT contact_name,
(SELECT COUNT(o.customer_id)
FROM orders o
WHERE o.customer_id = c.customer_id) as ordercount
FROM customers c
ORDER BY ordercount DESC

```

Expand All @@ -157,6 +193,12 @@ Reimport the Northwind database into PostgreSQL using pgAdmin. This is the same
</details>

```SQL
SELECT city,
(SELECT COUNT(o.ship_city)
FROM orders o
WHERE o.ship_city = c.city) as ordercount
FROM customers c
ORDER BY city

```

Expand All @@ -177,55 +219,35 @@ Below are some empty tables to be used to normalize the database
* Not all of the cells will contain data in the final solution
* Feel free to edit these tables as necessary

Table Name:

| | | | | | | | | |
|------------|------------|------------|------------|------------|------------|------------|------------|------------|
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |

Table Name:

| | | | | | | | | |
|------------|------------|------------|------------|------------|------------|------------|------------|------------|
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |

Table Name:

| | | | | | | | | |
|------------|------------|------------|------------|------------|------------|------------|------------|------------|
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |

Table Name:

| | | | | | | | | |
|------------|------------|------------|------------|------------|------------|------------|------------|------------|
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |

---
Table Name: People

| Person Id | Name | Fenced Yard | City Dweller |
|-----------|------|-------------|--------------|
| 1 | Jane | false | true |
| 2 | Bob | false | false |
| 3 | Sam | true | false |

Table Name: Pet types

| Pet Type Id | Pet Type |
|-------------|----------|
| 1 | Cat |
| 2 | Dog |
| 3 | Horse |
| 4 | Turtle |
| 5 | Fish |

Table Name: Pets

| Pet Id | Pet Type Id | Person Id | Pet Name |
|--------|-------------|-----------|------------|
| 1 | 2 | 1 | Ellie |
| 2 | 1 | 1 | Tiger |
| 3 | 4 | 1 | Toby |
| 4 | 3 | 2 | Joe |
| 5 | 2 | 3 | Ginger |
| 6 | 1 | 3 | Miss Kitty |
| 7 | 5 | 3 | Bubble |

### Stretch Goals

Expand Down