SQL Taskbook Level 4.10

Given a table:

products
id name category_id manufacturer_id price weight rating
1 product-1 1 2 100 1.5 5
2 product-2 2 3 200 1.7 4.3
3 product-3 2 3 150 0.8 2.2
4 product-4 3 3 500 0.9 3.3
5 product-5 3 2 750 1.0 4.9
6 product-6 1 5 800 0.5 3.9
7 product-7 1 5 900 10 4.0
8 product-8 1 2 175 12 3.5
9 product-9 2 1 245 5 4.2
10 product-10 1 2 260 4 4.1

Solve the following tasks for it:

Задание 1

Write a query that groups products into categories and calculates the average package weight for each category. The average package weight should be no greater than 0.7.

Задание 2

Write a query that groups products by manufacturer and calculates the average price for each manufacturer. The average price must be greater than 200.

Задание 3

Find the total cost of all products in each category and print the result. The cost of all products must be less than 250.

Задание 4

Write a query that groups products by manufacturer and finds the maximum product rating for each manufacturer. The maximum rating should be at least 4.