What is the average price of all products?
select avg ( product_price ) from products
Find the product type whose average price is higher than the average price of all products.
select product_type_code from products group by product_type_code having avg ( product_price ) > ( select avg ( product_price ) from products )
What is the product name of that?
select product_name from products where product_type_code = ( select product_type_code from products group by product_type_code having avg ( product_price ) > ( select avg ( product_price ) from products ) )
Find the product type whose average price is lower than the average price of all products.
select product_type_code from products group by product_type_code having avg ( product_price ) < ( select avg ( product_price ) from products )
What are the product names?
select product_name from products where product_type_code = ( select product_type_code from products group by product_type_code having avg ( product_price ) < ( select avg ( product_price ) from products ) )
What are the prices of them?
select product_price from products where product_type_code = ( select product_type_code from products group by product_type_code having avg ( product_price ) < ( select avg ( product_price ) from products ) )