CSCI 343 SQL expressions

See the expressions page of the SQLite3 documentation for much more information.

C/Java vs SQL

Many C/Java operators work with SQL; however, there are some notable exceptions. Here are some things to watch out for.

String matching

SQL uses the LIKE operator for string matches. In this case the % matches zero or more characters and the _ matches one character By default, the string matching operator is not case sensative. For example, 'SQL' LIKE 'S%' and 'SQL' LIKE 'S_L' and 'SQL' LIKE 'sql' are all true.

Many SQL implementations support regular expression matches with a REGEXP or ~ operator.

Table operators

SQL has a few set operators for testing a value against the result of a table returned from a SELECT.