MySQL Numeric Functions

MySQL Numeric Functions

memorize.aimemorize.ai (lvl 286)
Section 1

Preview this deck

EXP()

Front

Star 0%
Star 0%
Star 0%
Star 0%
Star 0%

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Active users

0

All-time users

0

Favorites

0

Last updated

6 years ago

Date created

Mar 1, 2020

Cards (36)

Section 1

(36 cards)

EXP()

Front

Returns e raised to the power of the number. e is the base of natural logarithms. Example SELECT EXP(1); Syntax EXP(number) Parameters number* the power to raise e to e^number

Back

CEILING()

Front

Returns the smallest integer value that is greater than or equal to a number. Gives you the smallest integer that is larger than the value you provide. Good for rounding reals up into integers. Same as CEIL() Example SELECT CEILING(25.75); Syntax CEILING(number) Parameters number*

Back

DIV

Front

Used for integer division that returns integers. It will do the division and give you whatever number is before the decimal point. In other words, it will see how many times m can go into n and give you an integer for that value. Example SELECT 10 DIV 5; For context, this is 10/5 Syntax n DIV m Parameters n* The value that will be divided by m m* The value that will be divided into n

Back

ASIN()

Front

Returns the arc sine of a number. Example SELECT ASIN(0.25); Syntax ASIN(number) Parameters number*

Back

COST()

Front

Returns the cosine of a number. Example SELECT COS(2); Syntax COS(number) Parameter number*

Back

COT()

Front

Returns the cotangent of a number Example SELECT COT(6); Syntax COT(number) Paremeter number*

Back

SIN()

Front

Returns the sine of a number. Example SELECT SIN(2); Syntax SIN(number) Parameter number*

Back

LOG2()

Front

Returns the base-2 logarithm of a number. Example SELECT LOG2(6); Syntax LOG2(number) Parameters number* number to take the base-2 log of. Must be greater than 0

Back

LOG10()

Front

Returns the base-10 logarithm of a number Example SELECT LOG10(2); Syntax LOG10(number) Parameters number* number to take the base-10 log of. Must be greater than 0

Back

SQRT()

Front

Returns the square root of a number. Example SELECT SQRT(64); Syntax SQRT(number) Parameters number* positive number to calculate the square root of

Back

CEIL()

Front

Returns the smallest integer value that is greater than or equal to a number. Gives you the smallest integer that is larger than the value you provide. Good for rounding reals up into integers. Same as CEILING() Example SELECT CEIL(25.75); Syntax CEIL(number) Parameters number*

Back

ATAN()

Front

Returns the arc tangent of a number or the arc tangent of n and m. Example SELECT ATAN(2.5); Syntax ATAN(number) Syntax-2 ATAN(n, m) Parameters number* numeric value n, m* two numeric values to calculate the arc tangent of

Back

RADIANS()

Front

Converts a value in degrees to radians. Example SELECT RADIANS(180); Syntax RADIANS(number)

Back

MAX()

Front

Returns the maximum value of an expression. Goes through all the values and returns the largest one. Example SELECT MAX(Price) AS LargestPrice FROM Products; Syntax MAX(expression) Parameters expression* numeric value (can be a field or a formula)

Back

LN()

Front

Returns the natural logarithm of a number. Example SELECT LN(2); Syntax LN(number) Parameters number* the number to calculate the natural logarithm of. Must be greater than 0.

Back

POWER()

Front

Returns m raised to the nth power. Same as POW() Example SELECT POWER(4, 2); Note, this returns 4 raised to the 2nd power Syntax POWER(m, n) Parameters m* numeric value that is the base in the calculation n* numeric value that is the exponent used in the calculation

Back

TRUNCATE()

Front

Returns a number truncated to a certain number of decimal places. Example SELECT TRUNCATE(135.375, 2); Syntax TRUNCATE(number, decimal_places) Parameters number* number to shorten decimal_places the number of decimal places to truncate to. Must be positive or negative integer

Back

ATAN2()

Front

Returns the arc tangent of n and m Example SELECT ATAN2(0.50, 1); Syntax ATAN2(n, m) Parameters n, m* two numeric values to calculate the arc tangent of

Back

COUNT()

Front

Returns the number of records in a select query Example SELECT COUNT(ProductID) AS NumberOfProducts FROM Products; Syntax COUNT(expression) Parameters expression A field or a string value

Back

SIGN()

Front

Returns the sign of a number. If the number is greater than zero, it returns 1. If number is equal to zero, it returns 0. If number is less than zero, it returns -1. Example SELECT SIGN(255.5); Syntax SIGN(number) Parameter number*

Back

MOD()

Front

Returns the remainder of n divided by m. Does n/m. Example SELECT MOD(18, 4); Note, this returns 2 Syntax-1 MOD(n, m) Syntax-2 n MOD m Syntax-3 n % m Parameters n* The value that will be divided by m m* the value that will be divided into m

Back

SUM()

Front

Returns the summed value of an expression. Example SELECT SUM(Quantity) AS TotalItemsOrdered FROM OrderDetails; Syntax SUM(expression) Parameters expression* Numeric value (can be a field or a formula)

Back

AVG()

Front

Returns the arithmetic mean in a given column. Example SELECT AVG(Price) AS AveragePrice FROM Products; Syntax AVG(expression) Parameter expression* a numeric value (can be a field or a formula)

Back

ROUND()

Front

Returns a number rounded to a certain number of decimal places. Example SELECT ROUND(135.375, 2); Syntax ROUND(number, decimal_places) Parameters number* the number to round decimal_places Optional. If omitted, the function will return an integer.

Back

LEAST()

Front

Returns the minimum value in a list of expressions. Example SELECT LEAST(3, 12, 34, 8, 25); Syntax LEAST(expr1, expr2, expr3, ...) Parameters expr1, expr2, expr3,* the expression list to be evaluated

Back

ACOS()

Front

Returns the arc cosine of a number. Example SELECT ACOS(0.25); Syntax ACOS(number) Parameters number*

Back

ABS()

Front

Returns the absolute value of a number. Example SELECT ABS(-243.5); Syntax ABS(number) Parameters number*

Back

DEGREES()

Front

Converts a radian value into degrees. Example SELECT DEGRESS(1.5); Syntax DEGREES(number) Parameter number*

Back

PI()

Front

returns the value of PI displayed with 6 decimal places. Example SELECT PI(); Syntax PI()

Back

POW()

Front

Returns m raised to the nth power. Same as POWER() Example SELECT POW(4, 2); Note, this returns 4 raised to the 2nd power Syntax POW(m, n) Parameters m* numeric value that is the base in the calculation n* numeric value that is the exponent used in the calculation

Back

TAN()

Front

Returns the tangent of a number Example SELECT TAN(1.75); Syntax TAN(number) Parameters number*

Back

GREATEST()

Front

Returns the maximum value in a list of expressions. Example SELECT GREATEST(3, 12, 34, 8, 25); Syntax GREATEST(expr1, expr2, expr3, ...) Parameters expr1, expr2, expr3,* the expression list to be evaluated

Back

RAND()

Front

Returns a random decimal number from 0 to 1. Can be 0, cannot be 1. If you provide no seed, the number is random. If you provide a seed, it will always produce those same numbers each time you use that same seed. Example SELECT RAND(); Syntax RAND(seed) Parameters seed Optional

Back

LOG()

Front

Returns the natural logarithm of a number, or the logarithm of a number to a specified base. Example SELECT LOG (2); Syntax LOG(number) Syntax2 LOG(base, number) Parameters number* The number to return the natural logarithm of. Must be greater than 0. base the base the natural logarithm is to be calculated with. Must be greater than 1.

Back

MIN()

Front

Returns the minimum value of an expression. Goes through all the values and returns the smallest one. Example SELECT MIN(Price) AS SmallestPrice FROM Products; Syntax MIN(expression) Parameters expression* numeric value (can be a field or a formula)

Back

FLOOR()

Front

Returns the largest integer value that is greater than or equal to a number. Used to round down. Turn reals into integers. Example SELECT FLOOR(25.75) Syntax FLOOR(number) Parameters number*

Back