SELECT with a GROUP BY and ROLLUP

In this exercise we will query the products table, group the results by product_id and then generate multiple grouping sets from the results using ROLLUP.

SELECT product_id,
supplier_id,
product_name,
SUM(units_in_stock)
FROM products
GROUP BY product_id,
ROLLUP(supplier_id);
Run in terminal

This query should return 154 rows

SELECT with a GROUP BY and PARTIAL ROLLUP

In this exercise we will query the products table, group the results by product_id and then generate multiple grouping sets from the results using ROLLUP.

SELECT product_id,
supplier_id,
product_name,
SUM(units_in_stock)
FROM products
GROUP BY product_id ROLLUP(supplier_id, product_id);
Run in terminal

This query should return TBD rows