Chapter 13:
SQL Predefined Functions:
- Numeric functions
- Date function
- String functions
Numeric Functions:
Absolute: The ABS() function returns the absolute value of a number.

Average: The AVG() function returns the average value of an expression.

Count: The COUNT() function returns the number of records returned by a select query.

Max: The MAX() function returns the maximum value in a set of values.

Min: The MIN() function returns the minimum value in a set of values.

Sum: The SUM() function calculates the sum of a set of values.

Round: The Round() function rounds a number to a specified number of decimal places.

Square: The Square() function returns the square of a number.

SquareRoot: The SQRT() function returns the square root of a number.

Power: The POWER() function returns the value of a number raised to the power of another number.

PI: The PI() function returns the value of PI.

CEILING: The CEILING() function returns the smallest integer value that is larger than or equal to a number.

Floor: The FLOOR() function returns the largest integer value that is smaller than or equal to a number.

Date Function:
Current Timestamp: The CURRENT_TIMESTAMP() function returns the current date and time, in a 'YYYY-MM-DD hh:mm:ss:mmm' format.

DATEADD: The DATEADD() function adds a time/date interval to a date and then returns the date.

DATEDIFF: The DATEDIFF() function returns the difference between two dates.

DATEFROMPARTS: The DATEFROMPARTS() function returns a date from the specified parts(year, month and day values).

DATENAME: The DATENAME() function returns a specified part of a date.

DATEPART: The DATEPART() function returns a specified part of a date.

DAY: The DAY() function returns the day of the month for a specified date.

GETDATE: The GETDATE() function returns the current database system date and time, in a 'YYYY-MM-DD hh:mm:ss:mmm' format.

GETUTCDATE: The GETUTCDATE() function returns the current database system UTC date and time, in a 'YYYY-MM-DD hh:mm:ss:mmm' format.

ISDATE: The ISDATE() function checks an expression and returns 1 if it is a valid date, otherwise 0.


MONTH: The MONTH() function returns the month part for a specified date( a number from 1 to 12).

SYSDATETIME: The SYSDATETIME() function returns the date and time of the computer where the SQL Server is running.

YEAR: The YEAR() function returns the year part of a specified date.

String Function:


