S_Function_A_Function_SQL_Assignment_4
S_Function_A_Function_SQL_Assignment_4
S_Function_A_Function_SQL_Assignment_4
1. Scalar Functions
• Definition: Scalar functions return a single value based on the input value(s). They operate
on individual values and return one result per row.
• Key Characteristics:
o Work on each row independently.
o Often used in the SELECT statement.
Syntax:
SELECT scalar_function(column_name)
FROM table_name
[WHERE condition];
2. Aggregate Functions
• Definition: Aggregate functions perform calculations on a set of rows and return a single
value. They are commonly used with GROUP BY to summarize data.
• Key Characteristics:
o Work on groups of rows.
o Often used in SELECT statements with group-based operations.
Syntax:
SELECT aggregate_function(column_name) FROM table_name [WHERE condition] [GROUP
BY column_name];
Assignment No. – 4