Basic aggregations based on groups of values
o_name value.
Using the aggregation as a subquery
o_totalprice.
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
SELECT SUM(o_totalprice) AS sum_of_totalprice,
COUNT(o_totalprice) AS total_number_of_purches,
AVG(o_totalprice) AS avg_price,
STDDEV(o_totalprice) AS stddev_from_avg,
MIN(o_date) AS the_minimum_date,
MAX(o_date) AS the_maximum_date,
o_name
FROM orders
GROUP BY o_name
ORDER BY sum_of_totalprice;
o_name value.
SELECT * FROM orders
WHERE o_totalprice = (SELECT MAX(o_totalprice)
FROM orders
);
o_totalprice.
GROUP BY columnSELECT
SUM((sale_price - purchse_price) * number_of_sold_items) AS total_profit
FROM transactions;
SELECT COUNT( DISTINCT c_name) as customers FROM customers;
SELECT COUNT(DISTINCT purchse_price+sale_price) FROM transactions;
Was this page helpful?