├── LICENSE ├── Northwind-Exercises.pdf ├── Northwind-Exercises.sql ├── Northwind.png ├── Querying-the-database-General-Exercises-Part-1.pdf ├── Querying-the-database-General-Exercises-Part-1.sql ├── Querying-the-database-General-Exercises-Part-2.pdf ├── Querying-the-database-General-Exercises-Part-2.sql └── README.md /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 eirkostop 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Northwind-Exercises.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eirkostop/SQL-Northwind-exercises/d85cabcbc99f6c8bb04b07c6f66f7a6b0d1d46a7/Northwind-Exercises.pdf -------------------------------------------------------------------------------- /Northwind-Exercises.sql: -------------------------------------------------------------------------------- 1 | use Northwind; 2 | go 3 | 4 | --Exercise Simple SQL Queries 5 | 6 | --1. Get all columns from the tables Customers, Orders and Suppliers 7 | 8 | SELECT * FROM Customers; 9 | SELECT * FROM Orders; 10 | SELECT * FROM Suppliers; 11 | 12 | --2. Get all Customers alphabetically, by Country and name 13 | 14 | SELECT * 15 | FROM Customers 16 | ORDER BY Country, ContactName; 17 | 18 | --3. Get all Orders by date 19 | 20 | SELECT * 21 | FROM Orders 22 | ORDER BY OrderDate; 23 | 24 | --4. Get the count of all Orders made during 1997 25 | 26 | SELECT COUNT(*) AS [Number of Orders During 1997] 27 | FROM Orders 28 | WHERE YEAR(OrderDate) = 1997 29 | --WHERE OrderDate BETWEEN '1997-1-1' AND '1997-12-31'; 30 | --WHERE OrderDate LIKE '%1997%' 31 | 32 | --5. Get the names of all the contact persons where the person is a manager, alphabetically 33 | 34 | SELECT ContactName 35 | FROM Customers 36 | WHERE ContactTitle LIKE '%Manager%' 37 | ORDER BY ContactName; 38 | 39 | --6. Get all orders placed on the 19th of May, 1997 40 | 41 | SELECT * 42 | FROM Orders 43 | WHERE OrderDate = '1997-05-19'; 44 | 45 | --Exercise SQL Queries for JOINS 46 | 47 | ---1. Create a report for all the orders of 1996 and their Customers (152 rows) 48 | 49 | SELECT * 50 | FROM Orders o 51 | INNER JOIN Customers c ON o.CustomerID = c.CustomerID 52 | WHERE YEAR(o.OrderDate) = '1996'; 53 | 54 | --2. Create a report that shows the number of employees and customers from each city that has employees in it (5 rows) 55 | 56 | SELECT e.City AS City, COUNT(DISTINCT e.EmployeeID) AS [Number of Employees], COUNT(DISTINCT c.CustomerID) AS [Number of Customers] 57 | FROM Employees e 58 | LEFT JOIN Customers c ON e.City = c.City 59 | GROUP BY e.City 60 | ORDER BY City; 61 | 62 | --3. Create a report that shows the number of employees and customers from each city that has customers in it (69 rows) 63 | 64 | SELECT c.City AS City, COUNT(DISTINCT c.CustomerID) AS [Number of Customers], COUNT(DISTINCT e.EmployeeID) AS [Number of Employees] 65 | FROM Employees e 66 | RIGHT JOIN Customers c ON e.City = c.City 67 | GROUP BY c.City 68 | ORDER BY City; 69 | 70 | --4. Create a report that shows the number of employees and customers from each city (71 rows) 71 | 72 | SELECT 73 | e.City, 74 | c.City, 75 | COUNT(DISTINCT e.EmployeeID) AS [Number of Employees], 76 | COUNT(DISTINCT c.CustomerID) AS [Number of Customers] 77 | FROM Employees e 78 | FULL JOIN Customers c ON e.City = c.City 79 | GROUP BY e.City, c.City 80 | ORDER BY e.City; 81 | 82 | SELECT 83 | ISNULL (e.City, c.City) AS [City], 84 | COUNT(DISTINCT e.EmployeeID) AS [Number of Employees], 85 | COUNT(DISTINCT c.CustomerID) AS [Number of Customers] 86 | FROM Employees e FULL JOIN Customers c ON 87 | e.City = c.City 88 | GROUP BY e.City, c.City 89 | ORDER BY [City]; 90 | 91 | --Exercise SQL Queries for HAVING 92 | 93 | --1. Create a report that shows the order ids and the associated employee names for orders that 94 | --shipped after the required date (37 rows) 95 | 96 | SELECT o.OrderID, e.LastName, e.FirstName 97 | FROM Orders o 98 | JOIN Employees e ON o.EmployeeID = e.EmployeeID 99 | AND o.ShippedDate > o.RequiredDate; 100 | 101 | --2. Create a report that shows the total quantity of products (from the Order_Details table) 102 | --ordered. Only show records for products for which the quantity ordered is fewer than 200 (5 rows) 103 | 104 | SELECT o.ProductID, p.ProductName, SUM(o.Quantity) AS [Total Quantity] 105 | FROM [Order Details] o 106 | JOIN Products p ON p.ProductID = o.ProductID 107 | GROUP BY o.ProductID, p.ProductName 108 | HAVING SUM(o.Quantity) < 200 109 | ORDER BY [Total Quantity] DESC; 110 | 111 | --3. Create a report that shows the total number of orders by Customer since December 31, 1996. The report should only return rows for which the total number of orders is greater than 15 (5 rows) 112 | 113 | SELECT CustomerID, COUNT(OrderID) AS [Total Number of Orders] 114 | FROM Orders 115 | WHERE OrderDate > '1996-12-31' 116 | GROUP BY CustomerID 117 | HAVING COUNT(OrderID) > 15 118 | ORDER BY [Total Number of Orders]; 119 | 120 | --Exercise SQL Inserting Records 121 | 122 | BEGIN TRANSACTION 123 | 124 | --1. Insert yourself into the Employees table. Include the following fields: LastName, FirstName, Title, TitleOfCourtesy, BirthDate, HireDate, City, Region, PostalCode, Country, HomePhone, ReportsTo 125 | 126 | INSERT INTO Employees(LastName, FirstName, Title, TitleOfCourtesy, BirthDate,HireDate, City, Region, PostalCode, Country, HomePhone, ReportsTo) 127 | VALUES('Amartolos', 'Nikos', 'Student', 'Mr.', '1992-09-14','2019-03-01', 'Athens', NULL, '11523', 'Greece', '2101234567', 5) 128 | 129 | --2. Insert an order for yourself in the Orders table. Include the following fields: CustomerID, EmployeeID, OrderDate, RequiredDate 130 | 131 | DECLARE @employee_id int = SCOPE_IDENTITY(); 132 | 133 | INSERT INTO Orders (CustomerID, EmployeeID, OrderDate, RequiredDate) VALUES ('VINET', @employee_id, '2019-03-01','2019-03-02') 134 | 135 | --3. Insert order details in the Order_Details table. Include the following fields: OrderID, ProductID, UnitPrice, Quantity, Discount 136 | 137 | DECLARE @order_id int = SCOPE_IDENTITY(); 138 | DECLARE @product_id int = 1; 139 | INSERT INTO [Order Details] VALUES(@order_id, @product_id, 10.0, 15, 0); 140 | 141 | COMMIT 142 | 143 | --Exercise SQL Updating Records 144 | 145 | --1. Update the phone of yourself (from the previous entry in Employees table) (1 row) 146 | 147 | SELECT * FROM Employees 148 | UPDATE Employees 149 | SET HomePhone = '(+30)2101234567' 150 | WHERE EmployeeID = @employee_id; 151 | 152 | --2. Double the quantity of the order details record you inserted before (1 row) 153 | 154 | SELECT * FROM [Order Details]; 155 | UPDATE [Order Details] 156 | SET Quantity = 2 * Quantity 157 | WHERE OrderID = @order_id AND ProductID = @product_id; 158 | 159 | --3. Repeat previous update but this time update all orders associated with you (1 row) 160 | 161 | SELECT * FROM Orders 162 | UPDATE [Order Details] 163 | SET Quantity = 2 * Quantity 164 | FROM [Order Details] 165 | JOIN Orders ON Orders.OrderID = [Order Details].OrderID 166 | WHERE Orders.EmployeeID = @employee_id; 167 | 168 | --Exercise SQL Deleting Records 169 | 170 | --1. Delete the records you inserted before. Don't delete any other records! 171 | 172 | BEGIN TRANSACTION 173 | DELETE FROM [Order Details] WHERE OrderID = @order_id AND ProductID = @product_id; 174 | DELETE FROM Orders WHERE EmployeeID = @employee_id; 175 | DELETE FROM Employees WHERE EmployeeID = @employee_id; 176 | COMMIT 177 | 178 | --Exercise Advances SQL queries 179 | 180 | --1. What were our total revenues in 1997 (Result must be 617.085,27) 181 | 182 | SELECT SUM(([Order Details].UnitPrice)* [Order Details].Quantity * (1.0-[Order Details].Discount)) AS [1997 Total Revenues] 183 | FROM [Order Details] 184 | INNER JOIN (SELECT OrderID FROM Orders WHERE YEAR(OrderDate) = '1997') AS Ord 185 | ON Ord.OrderID = [Order Details].OrderID 186 | 187 | --2. What is the total amount each customer has payed us so far (Hint: QUICK-Stop has payed us 110.277,32) 188 | 189 | SELECT Customers.CompanyName, SUM([Order Details].UnitPrice * [Order Details].Quantity * (1.0- [Order Details].Discount)) AS [Total] 190 | FROM Customers 191 | INNER JOIN Orders ON Customers.CustomerID = Orders.CustomerID 192 | INNER JOIN [Order Details] ON [Order Details].OrderID = Orders.OrderID 193 | GROUP BY Customers.CompanyName 194 | ORDER BY [Total] DESC; 195 | 196 | --3. Find the 10 top selling products (Hint: Top selling product is "Cote de Blaye") 197 | 198 | SELECT Products.ProductName, SUM([Order Details].UnitPrice * [Order Details].Quantity * (1.0- [Order Details].Discount)) AS [Sales] 199 | FROM Products 200 | INNER JOIN [Order Details] 201 | ON [Order Details].ProductID = Products.ProductID 202 | GROUP BY Products.ProductName 203 | ORDER BY [Sales] DESC; 204 | GO 205 | --4. Create a view with total revenues per customer 206 | 207 | DROP VIEW IF EXISTS [Total Revenues Per Customer]; 208 | GO 209 | CREATE VIEW [Total Revenues Per Customer] AS 210 | SELECT c.CustomerID, c.ContactName, ISNULL(CAST(CONVERT(money, SUM(od.UnitPrice * od.Quantity * (1.0-od.Discount)*100)/100) AS DECIMAL(11,2)),0) AS [Revenue] 211 | FROM Customers c 212 | FULL JOIN Orders o ON c.CustomerID = o.CustomerID 213 | FULL JOIN [Order Details] od ON od.OrderID = o.OrderID 214 | GROUP BY c.CustomerID, c.ContactName; 215 | GO 216 | 217 | SELECT * 218 | FROM [Total Revenues Per Customer] 219 | ORDER BY Revenue DESC; 220 | GO 221 | 222 | --5. Which UK Customers have payed us more than 1000 dollars (6 rows) 223 | 224 | SELECT Customers.ContactName, CONVERT(money,SUM([Order Details].UnitPrice * [Order Details].Quantity * (1.0- [Order Details].Discount)*100)/100) AS [Payments] 225 | FROM Customers 226 | INNER JOIN Orders ON Orders.CustomerID = Customers.CustomerID 227 | INNER JOIN [Order Details] ON [Order Details].OrderID = Orders.OrderID 228 | WHERE Customers.Country = 'UK' 229 | GROUP BY Customers.ContactName 230 | HAVING SUM([Order Details].UnitPrice * [Order Details].Quantity * (1.0- [Order Details].Discount)) > 1000; 231 | 232 | --6. How much has each customer payed in total and how much in 1997. 233 | 234 | SELECT Customers.CustomerID, Customers.CompanyName, Customers.Country, ISNULL(SUM([Order Subtotals].Subtotal), 0) AS [Customer Total], ISNULL(SUM(CONVERT(money, [1997].Payments/100)*100),0) AS [1997] 235 | FROM Customers 236 | LEFT JOIN Orders ON Orders.CustomerID = Customers.CustomerID 237 | LEFT JOIN [Order Details] ON [Order Details].OrderID = Orders.OrderID 238 | LEFT JOIN [Order Subtotals] ON [Order Subtotals].OrderID = Orders.OrderID 239 | LEFT JOIN (SELECT Customers.CustomerID, Customers.CompanyName, Customers.Country, ([Order Details].UnitPrice * [Order Details].Quantity * (1.0- [Order Details].Discount)) AS [Payments] 240 | FROM Customers 241 | INNER JOIN Orders ON Orders.CustomerID = Customers.CustomerID 242 | INNER JOIN [Order Details] ON [Order Details].OrderID = Orders.OrderID 243 | WHERE YEAR(Orders.OrderDate) = '1997') AS [1997] 244 | ON [1997].CustomerID = Customers.CustomerID 245 | GROUP BY Customers.CustomerID, Customers.CompanyName, Customers.Country 246 | ORDER BY [Customer Total] 247 | 248 | --SELECT * FROM Customers 249 | 250 | --SELECT [Order Subtotals].OrderID, [Order Subtotals].Subtotal 251 | --FROM [Order Subtotals] 252 | 253 | 254 | 255 | 256 | 257 | 258 | -------------------------------------------------------------------------------- /Northwind.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eirkostop/SQL-Northwind-exercises/d85cabcbc99f6c8bb04b07c6f66f7a6b0d1d46a7/Northwind.png -------------------------------------------------------------------------------- /Querying-the-database-General-Exercises-Part-1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eirkostop/SQL-Northwind-exercises/d85cabcbc99f6c8bb04b07c6f66f7a6b0d1d46a7/Querying-the-database-General-Exercises-Part-1.pdf -------------------------------------------------------------------------------- /Querying-the-database-General-Exercises-Part-1.sql: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eirkostop/SQL-Northwind-exercises/d85cabcbc99f6c8bb04b07c6f66f7a6b0d1d46a7/Querying-the-database-General-Exercises-Part-1.sql -------------------------------------------------------------------------------- /Querying-the-database-General-Exercises-Part-2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eirkostop/SQL-Northwind-exercises/d85cabcbc99f6c8bb04b07c6f66f7a6b0d1d46a7/Querying-the-database-General-Exercises-Part-2.pdf -------------------------------------------------------------------------------- /Querying-the-database-General-Exercises-Part-2.sql: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eirkostop/SQL-Northwind-exercises/d85cabcbc99f6c8bb04b07c6f66f7a6b0d1d46a7/Querying-the-database-General-Exercises-Part-2.sql -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # sql-exercises 2 | 3 sets of Sql exercises on Northwind Database 3 | 4 | - Northwind Exercises [Questions](Northwind-Exercises.pdf) [Answers](Northwind-Exercises.sql) 5 | - Querying the database – Part 1 [Questions](Querying-the-database-General-Exercises-Part-1.pdf) [Answers](Querying-the-database-General-Exercises-Part-1.sql) 6 | - Querying the database – Part 2 [Questions](Querying-the-database-General-Exercises-Part-2.pdf) [Answers](Querying-the-database-General-Exercises-Part-2W.sql) 7 | 8 | ![alt text](Northwind.png) 9 | 10 | # Northwind Exercises 11 | 12 | [Questions](Northwind-Exercises.pdf) 13 | 14 | [Answers](Northwind-Exercises.sql) 15 | 16 | ## Exercise Simple SQL Queries 17 | 18 | Use the Northwind Demo Database. Write the queries for the following: 19 | 20 | 1. Get all columns from the tables Customers, Orders and Suppliers 21 | 2. Get all Customers alphabetically, by Country and name 22 | 3. Get all Orders by date 23 | 4. Get the count of all Orders made during 1997 24 | 5. Get the names of all the contact persons where the person is a manager, alphabetically 25 | 6. Get all orders placed on the 19th of May, 1997 26 | 27 | ## Exercise SQL Queries for JOINS 28 | 29 | Using the Northwind Database, write the queries for the following: 30 | 31 | 1. Create a report for all the orders of 1996 and their Customers (152 rows) 32 | 2. Create a report that shows the number of employees and customers from each city that has 33 | employees in it (5 rows) 34 | 3. Create a report that shows the number of employees and customers from each city that has 35 | customers in it (69 rows) 36 | 4. Create a report that shows the number of employees and customers from each city ( 37 | rows) 38 | 39 | ## Exercise SQL Queries for HAVING 40 | 41 | 1. Create a report that shows the order ids and the associated employee names for orders that 42 | shipped after the required date (37 rows) 43 | 2. Create a report that shows the total quantity of products (from the Order_Details table) 44 | ordered. Only show records for products for which the quantity ordered is fewer than 200 ( 45 | rows) 46 | 3. Create a report that shows the total number of orders by Customer since December 31,1996. The report should only return rows for which the total number of orders is greater 47 | than 15 (5 rows) 48 | 49 | ## Exercise SQL Inserting Records 50 | 51 | (Hint: use transactions) 52 | 1. Insert yourself into the Employees table 53 | Include the following fields: LastName, FirstName, Title, TitleOfCourtesy, BirthDate, HireDate, City, Region, PostalCode, Country, HomePhone, ReportsTo 54 | 2. Insert an order for yourself in the Orders table 55 | Include the following fields: CustomerID, EmployeeID, OrderDate, RequiredDate 56 | 3. Insert order details in the Order_Details table 57 | Include the following fields: OrderID, ProductID, UnitPrice, Quantity, Discount 58 | 59 | ## Exercise SQL Updating Records 60 | 61 | (Hint: use transactions) 62 | 63 | 1. Update the phone of yourself (from the previous entry in Employees table) (1 row) 64 | 2. Double the quantity of the order details record you inserted before (1 row) 65 | 3. Repeat previous update but this time update all orders associated with you (1 row) 66 | 67 | ## Exercise SQL Deleting Records 68 | 69 | (Hint: use transactions) 70 | 1. Delete the records you inserted before. Don't delete any other records! 71 | 72 | ## Exercise Advances SQL queries 73 | 74 | 1. What were our total revenues in 1997 (Result must be 617.085,27) 75 | 2. What is the total amount each customer has payed us so far (Hint: QUICK-Stop has payed us 76 | 110.277,32) 77 | 3. Find the 10 top selling products (Hint: Top selling product is "Côte de Blaye") 78 | 4. Create a view with total revenues per customer 79 | 5. Which UK Customers have payed us more than 1000 dollars (6 rows) 80 | 6. How much has each customer payed in total and how much in 1997. We want one result set 81 | with the following columns: 82 | * CustomerID 83 | * CompanyName 84 | * Country 85 | * Customer's total from all orders 86 | * Customer's total from 1997 orders 87 | You can try this with views, subqueries or temporary tables. Try using [Order Subtotals] 88 | view that already exists in database. (91 rows, Customer "Centro comercial Moctezuma" has 89 | 100,80 total revenues and zero (0) revenues in 1997 ) 90 | 91 | 92 | SQL Practice Exercises – General 93 | # Querying the database – Part 1 94 | 95 | [Questions](Querying-the-database-General-Exercises-Part-1.pdf) 96 | 97 | [Answers](Querying-the-database-General-Exercises-Part-1.sql) 98 | 99 | 1. Select all category names with their descriptions from the Categories table. 100 | 2. Select the contact name, customer id, and company name of all Customers in London 101 | 3. Marketing managers and sales representatives have asked you to select all available columns in the Suppliers tables that have a FAX number. 102 | 4. Select a list of customers id’s from the Orders table with required dates between Jan 1, 1997 and Jan 1, 1998 and with freight under 100 units. 103 | 5. Select a list of company names and contact names of all the Owners from the Customer table from Mexico, Sweden and Germany. 104 | 6. Count the number of discontinued products in the Products table. 105 | 7. Select a list of category names and descriptions of all categories beginning with 'Co' from the Categories table. 106 | 8. Select all the company names, city, country and postal code from the Suppliers table with the word 'rue' in their address. The list should be ordered alphabetically by company name. 107 | 9. Select the product id and the total quantities ordered for each product id in the Order Details table. 108 | 10. Select the customer name and customer address of all customers with orders that shipped using Speedy Express. 109 | 11. Select a list of Suppliers containing company name, contact name, contact title and region description. 110 | 12. Select all product names from the Products table that are condiments. 111 | 13. Select a list of customer names who have no orders in the Orders table. 112 | 14. Add a shipper named 'Amazon' to the Shippers table using SQL. 113 | 15. Change the company name from 'Amazon' to 'Amazon Prime Shipping' in the Shippers table using SQL. 114 | 16. Select a complete list of company names from the Shippers table. Include freight totals rounded to the nearest whole number for each shipper from the Orders table for those shippers with orders. 115 | 17. Select all employee first and last names from the Employees table by combining the 2 columns aliased as 'DisplayName'. The combined format should be 'LastName, FirstName'. 116 | 18. Add yourself to the Customers table with an order for 'Grandma's Boysenberry Spread'. 117 | 19. Remove yourself and your order from the database. 118 | 20. Select a list of products from the Products table along with the total units in stock for each product. Give the computed column a name using the alias, 'TotalUnits'. Include only products with TotalUnits greater than 100. 119 | 120 | # Querying the database – Part 2 121 | 122 | [Questions](Querying-the-database-General-Exercises-Part-2.pdf) 123 | 124 | [Answers](Querying-the-database-General-Exercises-Part-2.sql) 125 | 126 | 1. Select the name, address, city, and region of employees. 127 | 2. Select the name, address, city, and region of employees living in USA. 128 | 3. Select the name, address, city, and region of employees older than 50 years old. 129 | 4. Select the name, address, city, and region of employees that have placed orders to be delivered in Belgium. Write two versions of the query, with and without join. 130 | 5. Select the employee name and the customer name for orders that are sent by the company ‘Speedy Express’ to customers who live in Brussels. 131 | 6. Select the title and name of employees who have sold at least one of the products ‘Gravad Lax’ or ‘Mishi Kobe Niku’. 132 | 7. Select the name and title of employees and the name and title of the person to which they refer (or null for the latter values if they don’t refer to another employee). 133 | 8. Select the customer name, the product name and the supplier name for customers who live in London and suppliers whose name is ‘Pavlova, Ltd.’ or ‘Karkki Oy’. 134 | 9. Select the name of products that were bought or sold by people who live in London. Write two versions of the query, with and without union. 135 | 10. Select the names of employees who are strictly older than: (a) an employee who lives in London. (b) any employee who lives in London. 136 | 11. Select the name of employees who work longer than any employee of London. 137 | 12. Select the name of employees and the city where they live for employees who have sold to customers in the same city. 138 | 14. Select the name of customers who have not purchased any product. 139 | 14. Select the name of customers who bought all products with price less than 5. 140 | 15. Select the name of the products sold by all employees. 141 | 16. Select the name of customers who bought all products purchased by the customer whose identifier is ‘LAZYK’ 142 | 17. Select the name of customers who bought exactly the same products as the customer whose identifier is ‘LAZYK’ 143 | 18. Select the average price of products by category. 144 | 19. Given the name of the categories and the average price of products in each category. 145 | 20. Select the identifier and the name of the companies that provide more than 3 products. 146 | 21. Select the identifier, name, and number of orders of employees, ordered by the employee identifier. 147 | 22. For each employee give the identifier, name, and the number of distinct products sold, ordered by the employee identifier. 148 | 23. Select the identifier, name, and total sales of employees, ordered by the employee identifier. 149 | 24. Select the identifier, name, and total sales of employees, ordered by the employee identifier for employees who have sold more than 70 different products. 150 | 25. Select the names of employees who sell the products of more than 7 suppliers. 151 | 26. Select the customer name and the product name such that the quantity of this product bought by the customer in a single order is more than 5 times the average quantity of this product bought in a single order among all clients. --------------------------------------------------------------------------------