SQL Functions Reference

AVG()

Aggregate

Calculates the average value of a numeric column.

AVG(expression)

CONCAT()

String

Concatenates two or more string values.

CONCAT(string1, string2, ...)

CURDATE()

Date

Returns the current date.

CURDATE()

ROUND()

Numeric

Rounds a number to a specified number of decimal places.

ROUND(number, decimals)

IF()

Conditional

Returns a value if a condition is true, otherwise returns another value.

IF(condition, value_if_true, value_if_false)

COUNT()

Aggregate

Counts the number of rows or non-NULL values in a column.

COUNT(expression)

UPPER()

String

Converts a string to uppercase.

UPPER(string)

LOWER()

String

Converts a string to lowercase.

LOWER(string)

NOW()

Date

Returns the current date and time.

NOW()

ABS()

Numeric

Returns the absolute value of a number.

ABS(number)

SUM()

Aggregate

Calculates the sum of values in a numeric column.

SUM(expression)

SUBSTRING()

String

Extracts a part of a string.

SUBSTRING(string, start, length)

DATE_FORMAT()

Date

Formats a date value into a different format.

DATE_FORMAT(date, format)

CEIL()

Numeric

Returns the smallest integer value greater than or equal to a number.

CEIL(number)

CASE

Conditional

Allows for conditional logic within SQL queries.

CASE WHEN condition1 THEN result1 WHEN condition2 THEN result2 ... ELSE result_else END