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
81 changes: 61 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Working with SQL

Reimport the Northwind database into PostgreSQL using pgAdmin. This is the same data we used during the guided project. You can find a copy of the SQL script under the `assets` folder in this repository.

* [ ] ***pgAdmin data refresh***
* [x] ***pgAdmin data refresh***

* Select the northwind database created during the guided project.

Expand All @@ -29,7 +29,7 @@ Reimport the Northwind database into PostgreSQL using pgAdmin. This is the same

### Answer the following data queries. Keep track of the SQL you write by pasting it into this document under its appropriate header below in the provided SQL code block. You will be submitting that through the regular fork, change, pull process

* [ ] ***find all customers that live in London. Returns 6 records***
* [x] ***find all customers that live in London. Returns 6 records***

<details><summary>hint</summary>

Expand All @@ -38,9 +38,12 @@ Reimport the Northwind database into PostgreSQL using pgAdmin. This is the same

```SQL

```
-- ```SELECT company_name, contact_name, contact_title, contact_title
-- ```FROM customers
-- ```WHERE city = 'London'


* [ ] ***find all customers with postal code 1010. Returns 3 customers***
* [x] ***find all customers with postal code 1010. Returns 3 customers***

<details><summary>hint</summary>

Expand All @@ -49,9 +52,13 @@ Reimport the Northwind database into PostgreSQL using pgAdmin. This is the same

```SQL

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



* [ ] ***find the phone number for the supplier with the id 11. Should be (010) 9984510***
* [x] ***find the phone number for the supplier with the id 11. Should be (010) 9984510***

<details><summary>hint</summary>

Expand All @@ -60,9 +67,14 @@ Reimport the Northwind database into PostgreSQL using pgAdmin. This is the same

```SQL

```
```SELECT supplier_ID, contact_name, 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***
* [x] ***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 @@ -71,9 +83,17 @@ Reimport the Northwind database into PostgreSQL using pgAdmin. This is the same

```SQL

```
```SELECT order_date
```FROM orders
```ORDER BY orders DESC

/// DESC reverses the order




* [ ] ***find all suppliers who have names longer than 20 characters. Returns 11 records***

* [x] ***find all suppliers who have names longer than 20 characters. Returns 11 records***

<details><summary>hint</summary>

Expand All @@ -83,22 +103,38 @@ Reimport the Northwind database into PostgreSQL using pgAdmin. This is the same

```SQL

```
```SELECT company_name
```FROM suppliers
```WHERE LENGTH(company_name) > 20

//LENGTH filters something by there length


* [ ] ***find all customers that include the word 'MARKET' in the contact title. Should return 19 records***





* [x] ***find all customers that include the word 'MARKET' in the contact title. Should return 19 records***

<details><summary>hint</summary>

* This can be done with SELECT and a WHERE clause using the LIKE keyword
* Don't forget the wildcard '%' symbols at the beginning and end of your substring to denote it can appear anywhere in the string in question
* Remember to convert your contact title to all upper case for case insensitive comparing so upper(contact_title)
</details>
-- * This can be done with SELECT and a WHERE clause using the LIKE keyword
-- * Don't forget the wildcard '%' symbols at the beginning and end of your substring to denote it can appear anywhere in the string in question
-- * Remember to convert your contact title to all upper case for case insensitive comparing so upper(contact_title)
-- </details>

```SQL
-- ```SQL

-- ```SELECT contact_title
-- ```FROM customers
-- ```WHERE contact_title LIKE '%Market%'

```

* [ ] ***add a customer record for***



* [x] ***add a customer record for***
* customer id is 'SHIRE'
* company name is 'The Shire'
* contact name is 'Bilbo Baggins'
Expand All @@ -113,7 +149,12 @@ Reimport the Northwind database into PostgreSQL using pgAdmin. This is the same

```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')





* [ ] ***update _Bilbo Baggins_ record so that the postal code changes to _"11122"_***

Expand Down