Functions: ========== Multi row functions: ==================== => We can define on the entire table (on all columns of the table) at a time and we can get a single value as return type. => The multi-row functions: 1) max() 2) min() 3) sum() 4) avg() 5) count() 1) max(): --------- => can return the maximum value from the group/collection. Syntax: max(group/column-name) Scenario: --------- 1) Creating the employee table ------------------------------- create table ashokit_employees ( empId number(5), empFirstName varchar2(30), empLastName varchar2(30), designation varchar(40), department varchar2(40), salary decimal(10,2) ); 2) Insert the data into the table: ----------------------------------- insert into ashokit_employees values(&empId, &empFirstName, &empLastName, &designation, &department, &salary); 3) commit the data: ------------------- commit; 4) Find the maximum employee Id from the given table ===================================================== Query: select max(empId) from ashokit_employees; 5) Find the maximum employee First name: ======================================== Query: select max(empFirstName) from ashokit_employees; here: the maximum can be identified by the ASCII. 6) Find the maximum salary: ============================ Query: select max(salary) from ashokit_employees; min(): ------ syntax: min(collection/column) sum(): ------ Q: Write a SQL query to find the total estimations of employer for every month based on the given table? Syntax: sum(column) select sum(salary) from ashokit_employees; avg(): ------ => to find the average of the given record, we can use avg(). Syntax: avg(record) Q: Write a SQL a query to find the average salary of the ashokit_employees table? select avg(salary) as AverageSalary from ashokit_employees; Assignment: ----------- 1) Write a SQL query to find the minimum of employee last name. 2) Write a SQL query to find the minimum of employee department and designation. 3) Write a SQL query to find the total estimations of employer for the year according to the above table. Note: ----- avg() may return a value in floating-point format. Ex: 1 + 2 + 3 + 4 + 5 + 6 / 6 ==> 3.5 => to rounding-off or approximate the result of the avg(), we can use ceil() Syntax: ceil(avg) count(): -------- => to count the capacity of any particular column, we can use below syntax: count(specific-column) => to count the capacity of whole table, count(*) Ex: select count(empId) from ashokit_employees; select count(*) from ashokit_employees;