Page 102 - CITS - Computer Software Application -TT
P. 102
COMPUTER SOFTWARE APPLICATION - CITS
1 SUM: Calculates the sum of values in a column.
Example: Calculate the total revenue.
SELECT SUM(quantity * price) AS total_revenue FROM sales;
Result:
total_revenue
180.0
2 AVERAGE: Calculates the average of values in a column.
Example: Calculate the average price of products.
SELECT AVG(price) AS avg_price FROM sales;
Result:
avg_price
12.4
3 MAX: Finds the maximum value in a column.
Example: Find the maximum quantity sold.
SELECT MAX(quantity) AS max_quantity FROM sales;
Result:
max_quantity
6
4 MIN: Finds the minimum value in a column.
10.0
5 COUNT: Counts the number of rows in a table or the number of non-null values in a column.
Example: Count the number of orders.
SELECT COUNT(*) AS order_count FROM sales
Result:
order_count
5
Example-2
PRODUCT_GOOD
89
CITS : IT&ITES - Computer software application - Lesson 18 - 36