1. Call the aggregation function
sum: Returns the sum of all values and/or the sum of distinct data
avg: Average and ignore nulls
min: minimum value
max: maximum value
count: counting function
distinct: remove unique records
2. Mathematical functions
abs: absolute value
power: power. For example: power(2,2): 2 to the power of 2
rand: random floating-point number, take a random float value between 0-1
round: round up. For example: round (19.235467, 3) that retains three decimal places
sqrt: square root
square: square
3. String function:
ASCII:
left('fdksjahioa', 2): the second character from the left
right('fdksjahioa', 2): the second character from the right
len('23382748'): Returns the number of characters (including spaces before and after)
replace('A','B','C'): Replace the B part of A with C
reverse('asdfgh'): Reverse the string, the result is: 'hgfdsa'
str(A, B, C): Convert a numeric variable to a character variable. A is a number, B is the total length, and C is the number of digits after the decimal point. Returns ** if it exceeds the specified length
substring('A', 3, 5): Take the specified number of characters. Start from the third digit in string A and get to the fifth digit.
4. Functions of time and date:
getdate: returns the current time
day(date): Returns the part of an integer day
month(date): Returns the part of the month
year(date): Returns the part of the year
datediff(day, 'time1', "time2"): Difference between time 1 and time 2 according to the span of days. day can be replaced with other time spans
dateadd(day, n, "time"): add n day units to time
5. Conversion functions: Convert one data type to another data type
cost (A as B). A is the variable to be formatted, and B is the format to be changed.
convert('target type', 'target', 'changed format'). This function is mainly for functions that change the time type