You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 2d00ec2
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: README.md
+21-1Lines changed: 21 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,28 +10,48 @@ Answer the following data queries. Keep track of the SQL you write by pasting it
10
10
### **Clicking the `Restore Database` button in the page will repopulate the database with the original data and discard all changes you have made**.
11
11
12
12
### find all customers that live in London. Returns 6 records.
13
+
> This can be done with SELECT and WHERE clauses
13
14
14
15
### find all customers with postal code 1010. Returns 3 customers.
16
+
> This can be done with SELECT and WHERE clauses
15
17
16
18
### find the phone number for the supplier with the id 11. Should be (010) 9984510.
19
+
> This can be done with SELECT and WHERE clauses
17
20
18
21
### list orders descending by the order date. The order with date 1997-02-12 should be at the top.
22
+
> This can be done with SELECT, WHERE, and ORDER BY clauses
19
23
20
24
### find all suppliers who have names longer than 20 characters. You can use `length(SupplierName)` to get the length of the name. Returns 11 records.
25
+
> This can be done with SELECT and WHERE clauses
21
26
22
27
### find all customers that include the word "market" in the name. Should return 4 records.
28
+
> This can be done with SELECT and a WHERE clause using the LIKE keyword
29
+
30
+
> 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
23
31
24
32
### add a customer record for _"The Shire"_, the contact name is _"Bilbo Baggins"_ the address is _"1 Hobbit-Hole"_ in _"Bag End"_, postal code _"111"_ and the country is _"Middle Earth"_.
33
+
> This can be done with the INSERT INTO clause
25
34
26
35
### update _Bilbo Baggins_ record so that the postal code changes to _"11122"_.
36
+
> This can be done with UPDATE and WHERE clauses
27
37
28
38
### list orders grouped by customer showing the number of orders per customer. _Rattlesnake Canyon Grocery_ should have 7 orders.
39
+
> This can be done with SELECT, COUNT, JOIN and GROUP BY clauses. Your count should focus on a field in the Orders table, not the Customer table
40
+
41
+
> There is more information about the COUNT clause on [W3 Schools](https://www.w3schools.com/sql/sql_count_avg_sum.asp)
29
42
30
43
### list customers names and the number of orders per customer. Sort the list by number of orders in descending order. _Ernst Handel_ should be at the top with 10 orders followed by _QUICK-Stop_, _Rattlesnake Canyon Grocery_ and _Wartian Herkku_ with 7 orders each.
44
+
> This can be done by adding an ORDER BY clause to the previous answer
31
45
32
46
### list orders grouped by customer's city showing number of orders per city. Returns 58 Records with _Aachen_ showing 2 orders and _Albuquerque_ showing 7 orders.
47
+
> This is very similar to the previous two queries, however, it focuses on the City rather than the CustomerName
33
48
34
49
### delete all customers that have no orders. Should delete 17 (or 18 if you haven't deleted the record added) records.
50
+
> This is done with a DELETE query
51
+
52
+
> In the WHERE clause, you can provide another list with an IN keyword this list can be the result of another SELECT query. Write a query to return a list of CustomerIDs that meet the criteria above. Pass that to the IN keyword of the WHERE clause as the list of IDs to be deleted
53
+
54
+
> Use a LEFT JOIN to join the Orders table onto the Customers table and check for a NULL value in the OrderID column
35
55
36
56
## Create Database and Table
37
57
@@ -48,4 +68,4 @@ Answer the following data queries. Keep track of the SQL you write by pasting it
48
68
- the `id` should be the primary key for the table.
0 commit comments