SQLite built-in functions

Source: Internet
Author: User
Tags abs sqlite

Function Description
AVG (x) The function returns the average of the same set of internal reference numbers. For string and BLOB type field values that cannot be converted to numeric values, such as ' HELLO ', SQLite treats it as 0. The result of the AVG function is always floating-point, with the exception that all field values are null, and the result of the function is also null.
Count (x|*) The count (x) function returns the number of rows within the same group where the value in the X field is not equal to NULL. The count (*) function returns the number of rows of data within the same group.
Group_concat (X[,y]) The function returns a string that will concatenate all non-null x values. The y parameter of the function will be the delimiter between each x value, and the default delimiter "," will be used when connecting, if the argument is omitted at the time of invocation. Then there is the sequence of connections between the strings is indeterminate.
Max (x) The function returns the maximum value of the X field within the same group, and returns null if all the values of the field are null.
MIN (x) The function returns the minimum value of the X field within the same group, and returns null if all the values of the field are null.
SUM (x) The function returns the sum of the X field values within the same group, and returns null if the field value is null. If all the X field values are integer or NULL, the function returns an integer value, otherwise it returns a floating-point value. Finally, if all data values are integer, an "integer Overflow" exception will be thrown once the result exceeds the upper limit.
Total (x) This function is not part of standard SQL, and its function is basically the same as sum, except that it is more reasonable to calculate the result than sum. For example, when all field values are null, unlike sum, the function returns 0.0. Then there is the function that always returns a floating-point value. The function always does not throw an exception.

Function Description
ABS (X) The function returns the absolute value of the numeric parameter x, if x is NULL, returns NULL if X is a string that cannot be converted to a numeric value, returns 0 if the x value exceeds the upper bound of the integer, and throws an "integer Overflow" exception.
Changes () This function returns the number of data rows affected by the most recently executed insert, UPDATE, and DELETE statements. We can also get the same result by executing the C + + function sqlite3_changes ().
COALESCE (x, y,...) Returns the first non-null parameter in a function parameter, or null if the argument is null. The function has at least 2 parameters.
Ifnull (x, y) The function is equivalent to the COALESCE () function of two arguments, which returns the first non-null function argument, or null if two are null.
Length (X) If the argument x is a string, the number of characters is returned, and if it is a numeric value, the length of the string representation of the parameter is returned, or null if NULL.
Lower (X) Returns the lowercase form of the function parameter x, which, by default, can only be applied to ASCII characters.
LTrim (X[,y]) If there is no optional parameter Y, the function removes all whitespace characters to the left of parameter x. If you have parameter Y, remove any characters that appear in Y on the left side of X. Finally, the removed string is returned.
Max (x, y,...) Returns the maximum value in a function parameter, or null if any one of the arguments is null.
Min (x, y,...) Returns the minimum value in the function parameter, or null if any one of the arguments is null.
Nullif (x, y) Returns null if the function parameter is the same, otherwise the first argument is returned.
Random () Returns the pseudo-random number of an integral type.
Replace (x, Y, z) Replaces all substring y in function parameter x of the string type with string Z, and finally returns the replaced string, where the source string x remains unchanged.
Round (X[,y]) Returns the value of the numeric parameter x rounded to the Y-scale, and if the parameter y does not exist, the default parameter value is 0.
RTrim (X[,y]) If there is no optional parameter Y, the function removes all whitespace characters to the right of parameter x. If there is a parameter Y, remove any characters that appear in Y on the right side of X. Finally, the removed string is returned.
SUBSTR (X,y[,z]) Returns a substring of the function parameter x, starting with the Y-bit (the first character in X at position 1) intercepts the z-length character, and if the z-parameter is omitted, all characters following the Y-character are taken. If the value of Z is negative, the ABS (Z) character is truncated to the left, starting at the Y-bit. If the Y value is negative, start at the end of the X string, starting at the position of ABS (Y).
Total_changes () This function returns the total number of rows affected by the INSERT, update, and DELETE statements since the connection was opened. We can also get the same result through the C + + interface function sqlite3_total_changes ().
Trim (X[,y]) If there is no optional parameter Y, the function removes all whitespace characters on both sides of the parameter x. If you have parameter Y, remove any characters that appear in Y on either side of X. Finally, the removed string is returned.
Upper (X) Returns the uppercase form of the function parameter x, which, by default, can only be applied to ASCII characters.
typeof (X)

Returns a string representation of the function parameter data type, such as "Integer, text, real, null", and so on.

SQLite built-in functions

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.