From: drh Any SQLite value can be used as part of an expression.
-For arithmetic operations, integers are treated as integers.
-Strings are first converted to real numbers using atof().
-For comparison operators, numbers compare as numbers and strings
-compare using the strcmp() function.
-Note that there are two variations of the equals and not equals
+ Note that there are two variations of the equals and not equals
operators. Equals can be either}
puts "[Operator =] or [Operator ==].
The non-equals operator can be either
@@ -977,9 +971,77 @@ The non-equals operator can be either
The [Operator ||] operator is \"concatenate\" - it joins together
the two strings of its operands.
The operator [Operator %] outputs the remainder of its left
-operand modulo its right operand.
The result of any binary operator is a numeric value, except +for the [Operator ||] concatenation operator which gives a string +result.
" + puts { + ++A literal value is an integer number or a floating point number. +Scientific notation is supported. The "." character is always used +as the decimal point even if the locale setting specifies "," for +this role - the use of "," for the decimal point would result in +syntactic ambiguity. A string constant is formed by enclosing the +string in single quotes ('). A single quote within the string can +be encoded by putting two single quotes in a row - as in Pascal. +C-style escapes using the backslash character are not supported because +they are not standard SQL. +BLOB literals are string literals containing hexadecimal data and +preceded by a single "x" or "X" character. For example:
+ ++ ++X'53514697465' +
+A literal value can also be the token "NULL". +
+ ++A parameter specifies a placeholder in the expression for a literal +value that is filled in at runtime using the +sqlite3_bind API. +Parameters can take several forms: +
+?NNN | + | A question mark followed by a number NNN holds a spot for the +NNN-th parameter. NNN must be between 1 and 999. | +
? | + | A question mark that is not followed by a number holds a spot for +the next unused parameter. | +
:AAAA | + | A colon followed by an identifier name holds a spot for a named +parameter with the name AAAA. Named parameters are also numbered. +The number assigned is the next unused number. To avoid confusion, +it is best to avoid mixing named and numbered parameters. | +
$AAAA | + | A dollar-sign followed by an identifier name also holds a spot for a named +parameter with the name AAAA. The identifier name in this case can include +one or more occurances of "::" and a suffix enclosed in "(...)" containing +any text at all. This syntax is the form of a variable name in the Tcl +programming language. | +
Parameters that are not assigned values using +sqlite3_bind are treated +as NULL.
+The LIKE operator does a pattern matching comparison. The operand to the right contains the pattern, the left hand operand contains the @@ -1013,9 +1075,14 @@ characters on one side against lower case characters on the other. characters. Hence the LIKE operator is case sensitive for 8-bit iso8859 characters or UTF-8 characters. For example, the expression 'a' LIKE 'A' is TRUE but -'æ' LIKE 'Æ' is FALSE.). The infix LIKE -operator is identical the user function -like(X,Y). +'æ' LIKE 'Æ' is FALSE.).
+ +The infix LIKE +operator is implemented by calling the user function +like(X,Y). If an ESCAPE clause is present, it adds +a third parameter to the function call. If the functionality of LIKE can be +overridden by defining an alternative implementation of the +like() SQL function.
@@ -1023,8 +1090,17 @@ like(X,Y). file globbing syntax for its wildcards. Also, GLOB is case sensitive, unlike LIKE. Both GLOB and LIKE may be preceded by the NOT keyword to invert the sense of the test. The infix GLOB -operator is identical the user function -glob(X,Y). +operator is implemented by calling the user function +glob(X,Y) and can be modified by overriding +that function. + + +The REGEXP operator is a special syntax for the regexp() +user function. No regexp() user function is defined by default +and so use of the REGEXP operator will normally result in an +error message. If a user-defined function named "regexp" +is defined at run-time, that function will be called in order +to implement the REGEXP operator.
A column name can be any of the names defined in the CREATE TABLE statement or one of the following special identifiers: "ROWID", @@ -1066,6 +1142,10 @@ SELECT becomes the value used in the expression. If the SELECT yields more than one result row, all rows after the first are ignored. If the SELECT yields no rows, then the value of the SELECT is NULL.
+A CAST expression changes the datatype of the
Both simple and aggregate functions are supported. A simple function can be used in any expression. Simple functions return a result immediately based on their inputs. Aggregate functions