Introduction To Database: UCT - Mogadishu, Somalia
Introduction To Database: UCT - Mogadishu, Somalia
SQL Functions
Introduction to SQL
Aggregate Functions
Scalar Functions
Group By
Having
Introduction to SQL
Aggregate Functions
The AVG() function returns the average
value of a numeric column.
Aggregate Functions
The COUNT() function returns the number of rows that
matches a specified criteria.
SQL COUNT(column_name) Syntax
The COUNT(column_name) function returns the number of values
(NULL values will not be counted) of the specified column
Aggregate Functions
SQL COUNT(DISTINCT column_name) Syntax
The COUNT(DISTINCT column_name) function returns the
number of distinct values of the specified column:
Introduction to SQL
Aggregate Functions
SQL FIRST() Syntax
SELECT TOP 1 * FROM MPS;
SQL LAST() Syntax
SELECT TOP 1 * FROM MPS ORDER BY MPID DESC;
SQL Max() Syntax
SELECT Max(Pprice) FROM Plot;
SQL Min() Syntax
SELECT Min(Pprice) FROM Plot;
Aggregate Functions
SQL Sum() Syntax
The SUM() function returns the total sum of
a numeric column.
Select Sum(Pprice) from Plot
Introduction to SQL
Scalar Functions
UPPER Function
The UPPER function converts the value of a
field to uppercase.
Select Upper(MpName) from Mps;
LOWER Function
The LOWER function converts the value of a
field to lowercase.
Select Lower(MpName) from Mps;
Introduction to SQL
Scalar Functions
SubString Function
he SubString function is used to extract
characters from a text field
SELECT SUBSTRING(column_name,start,length)
AS some_name FROM table_name;
Scalar Functions
LEN Function
The LEN() function returns the length of the
value in a text field
Scalar Functions
Round Function
The Round() function is used to round a
numeric field to the number of decimals
specified.