Let's start from the simple one.
w3schools.com platform will be used for exercising
Task #1.
- Output unique countries (Country) from the Customers table, where CustomerName does NOT start with "A" and where City is anything but London.
- Sort records in reverse order.
- Limit the number of rows to a single row.
#task
w3schools.com platform will be used for exercising
Task #1.
- Output unique countries (Country) from the Customers table, where CustomerName does NOT start with "A" and where City is anything but London.
- Sort records in reverse order.
- Limit the number of rows to a single row.
#task
Task#2.
From the Products table, select the names of all products whose price values are integers, in addition, they must be products that do not belong to the following categories (CategoryID): 1, 2, 3, 4, 5, 6.
You can try your query here
You can share your solution in comment once the task is solved.
#task
From the Products table, select the names of all products whose price values are integers, in addition, they must be products that do not belong to the following categories (CategoryID): 1, 2, 3, 4, 5, 6.
You can try your query here
You can share your solution in comment once the task is solved.
#task
Task#3
Write a query that will display the FirstName of the employee who processed the most orders between 1996-09-02 and 1996-12-31.
Used tables: Orders, Employees.
You can use w3schools db for writing a query.
As soon as you're done with the task, feel free to share the name of the employee in the comment section to this task (but don't share the code itself, in order not to make a spoiler for others😉)
#task
Write a query that will display the FirstName of the employee who processed the most orders between 1996-09-02 and 1996-12-31.
Used tables: Orders, Employees.
You can use w3schools db for writing a query.
As soon as you're done with the task, feel free to share the name of the employee in the comment section to this task (but don't share the code itself, in order not to make a spoiler for others😉)
#task
Solution to Task#3
SELECT Employees.FirstName
FROM [Orders]
JOIN Employees USING(EmployeeID)
WHERE OrderDate BETWEEN "1996-09-02" AND "1996-12-31"
GROUP BY EmployeeID ORDER BY COUNT(*) DESC LIMIT 1
#task
SELECT Employees.FirstName
FROM [Orders]
JOIN Employees USING(EmployeeID)
WHERE OrderDate BETWEEN "1996-09-02" AND "1996-12-31"
GROUP BY EmployeeID ORDER BY COUNT(*) DESC LIMIT 1
#task
👏3
SQL Task
Table name: Customers;
Field name: City;
Select all the cities which names start with S, but not end with n.
You can execute query here
Hint: If you gonna use w3schools default database, the correct request should return 11 records.
Feel free to write your answer as a comment to this task.
#task
Table name: Customers;
Field name: City;
Select all the cities which names start with S, but not end with n.
You can execute query here
Hint: If you gonna use w3schools default database, the correct request should return 11 records.
Feel free to write your answer as a comment to this task.
#task
❤1👍1
You may see the Products table on the picture.
Write a query to find the second highest price value in the table.
You can execute query here
Please feel free to provide your solution in the comments to this post.
SOLUTION
SELECT MAX(Price) FROM Products WHERE Price < (SELECT MAX(Price) FROM Products);
#task
Write a query to find the second highest price value in the table.
You can execute query here
Please feel free to provide your solution in the comments to this post.
SOLUTION
😁1
Orders table structure is reflected on the picture.
1) Write a query to select the average number of orders made by the customers.
2) Round the result to one decimal place.
3) The resultant field should be named as follows:
AVG OrdersNumber.
Example: Let's say if someone from clients made 3 orders, another one made 5 orders, and someone else made 2 orders. So 10 / 3, and since the result should be rounded according the the task, the output will be: 3.3.
You may practice and execute your query here
Please feel free to provide your solution in the comments to this post.
NOTE: Please use the Spoiler feature, when posting your solution, in order to give the chance to think to others.
#task
1) Write a query to select the average number of orders made by the customers.
2) Round the result to one decimal place.
3) The resultant field should be named as follows:
AVG OrdersNumber.
Example: Let's say if someone from clients made 3 orders, another one made 5 orders, and someone else made 2 orders. So 10 / 3, and since the result should be rounded according the the task, the output will be: 3.3.
You may practice and execute your query here
Please feel free to provide your solution in the comments to this post.
NOTE: Please use the Spoiler feature, when posting your solution, in order to give the chance to think to others.
#task