1. Call aggregate function
Sum: Returns and/or non-duplicated data for all values
Avg: average and ignores null values
Min: Minimum value
Max: Max value
Count: Count function
Distinct: To go without repeating records
2. Mathematical functions
ABS: Absolute Value
Power: exponentiation. Example: Power (2,2): 2 of the 2-time Square
Rand: Random floating-point number, randomly taking a float value between 0-1
Round: Rounding. For example: Round (19.235467,3), which retains three digits after the decimal point
sqrt: square root
Square: Square
3. String function:
Ascii:
Left (' Fdksjahioa ', 2): 2nd character up
Right (' Fdksjahioa ', 2): 2nd character up
Len (' 23382748 '): Returns the number of characters (including front and back spaces)
Replace (' A ', ' B ', ' C '): Change the B part of A to C
Reverse (' asdfgh '): string in reverse order, with the result: ' HGFDSA '
STR (A,B,C): Converts a numeric variable into 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 the specified length is exceeded * *
SUBSTRING (' A ', 3,5): Takes a specified number of characters. Starting from the third bit in string A, take the fifth bit.
4. Functions of time and date:
GETDATE: Return to present time
Day: Returns the part of the integer date
Month (date): Returns the part of the month
Year (date): Returns the part of an annual
DateDiff (Day, ' time1 ', "time2"): Time 1 and time 2 are poor according to day's span. Day can be replaced by other time spans
DATEADD (Day,n, "Time"): Add N day units to times
5. Conversion function: Convert one data type to another data type
Cost (A as B). A is the variable that you want to format, and B is the format to change to.
Convert (' target type ', ' target ', ' changed format '). This function is primarily intended for functions that change the time type
1.4 SQL functions