SQL* Challenges
307 subscribers
5 photos
1 file
10 links
Download Telegram
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
😁1
Which type of relation is reflected on the picture?
Anonymous Quiz
26%
One-to-one
41%
One-to-many
25%
Many-to-many
9%
All-to-all
A view is nothing but a ________ table or a stored query
Anonymous Quiz
15%
Dynamic
3%
Real
10%
Custom
65%
Virtual
4%
Basic
3%
Common
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
After solving the task from the previous post, you may check your result, by selecting the correct option:
Anonymous Quiz
29%
3.2
48%
3.0
10%
2.8
10%
2.6
3%
1.9