SQL Taskbook Level 2.6

Given a table:

products
id name price amount category
1 Apple 1 320 Fruit
2 Cool Fig 2 100 Fruit
3 Potato 0.5 1000 Vegetables
4 Carrot 0.75 750 Vegetables
5 Beetroot 0.25 1500 Vegetables

Solve the following tasks for it:

Задание 1

List product categories and the number of products in each category, considering only categories with products whose price is lower than the average price in their category.

Задание 2

Find the products with the lowest price in each category, and indicate the average number of products in these categories.

Задание 3

Output the average price of products in each category and the median price for each category, considering only categories with more than 3 products.

Задание 4

Find products with stock quantities greater than 500 units and prices lower than 1 dollars.

Задание 5

Display products with two-word names and prices greater than 1.5 dollars.