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
Copy file name to clipboardExpand all lines: README.md
+26-7Lines changed: 26 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -36,38 +36,57 @@ Answer the following data queries. Keep track of the SQL you write by pasting it
36
36
### find all customers that live in London. Returns 6 records.
37
37
> This can be done with SELECT and WHERE clauses
38
38
39
+
39
40
### find all customers with postal code 1010. Returns 3 customers.
40
41
> This can be done with SELECT and WHERE clauses
41
42
43
+
42
44
### find the phone number for the supplier with the id 11. Should be (010) 9984510.
43
45
> This can be done with SELECT and WHERE clauses
44
46
45
-
### list orders descending by the order date. The order with date 1997-02-12 should be at the top.
47
+
48
+
### list orders descending by the order date. The order with date 1998-05-06 should be at the top.
46
49
> This can be done with SELECT, WHERE, and ORDER BY clauses
47
50
48
-
### 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.
51
+
52
+
### find all suppliers who have names longer than 20 characters. You can use `length(company_name)` to get the length of the name. Returns 11 records.
49
53
> This can be done with SELECT and WHERE clauses
50
54
51
-
### find all customers that include the word "market" in the name. Should return 4 records.
55
+
56
+
### find all customers that include the word 'MARKET' in the contact title. Should return 19 records.
52
57
> This can be done with SELECT and a WHERE clause using the LIKE keyword
53
58
54
59
> 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
55
60
56
-
### 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"_.
61
+
> Remember to convert your contact title to all upper case for case insenstive comparing so upper(contact_title)
62
+
63
+
64
+
### add a customer record for
65
+
### customer id is 'SHIRE'
66
+
### company name is 'The Shire'
67
+
### contact name is 'Bilbo Baggins'
68
+
### the address is '1 Hobbit-Hole'
69
+
### ths city is 'Bag End'
70
+
### the postal code is '111'
71
+
### the country is 'Middle Earth'
57
72
> This can be done with the INSERT INTO clause
58
73
74
+
59
75
### update _Bilbo Baggins_ record so that the postal code changes to _"11122"_.
60
76
> This can be done with UPDATE and WHERE clauses
61
77
62
-
### list orders grouped by customer showing the number of orders per customer. _Rattlesnake Canyon Grocery_ should have 7 orders.
78
+
79
+
### list orders grouped by customer showing the number of orders per customer. _Rattlesnake Canyon Grocery_ should have 18 orders.
63
80
> 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
64
81
65
82
> There is more information about the COUNT clause on [W3 Schools](https://www.w3schools.com/sql/sql_count_avg_sum.asp)
66
83
67
-
### 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.
84
+
85
+
### list customers names and the number of orders per customer. Sort the list by number of orders in descending order. _Save-a-lot Markets should be at the top with 31 orders followed by _Ernst Handle_ with 30 orders. Last should be _Centro comercial Moctezuma_ with 1 order.
68
86
> This can be done by adding an ORDER BY clause to the previous answer
69
87
70
-
### 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.
88
+
89
+
### list orders grouped by customer's city showing number of orders per city. Returns 58 Records with _Aachen_ showing 6 orders and _Albuquerque_ showing 18 orders.
71
90
> This is very similar to the previous two queries, however, it focuses on the City rather than the CustomerName
0 commit comments