Structured Query Language/Language Elements
From Wikibooks, open books for an open world
SQL consists of statements which start with a key word like SELECT, DELETE or CREATE and terminate with a semicolon. Their elements are case-insensitive with the exception of fixed character string values like 'Mr. Brown'.
- Clauses: Statements are subdivided into clauses. The most popular one is the WHERE clause.
- Predicates: Predicates specify conditions which can be evaluated to a boolean value. E.g.: a boolean comparison, BETWEEN, LIKE, IS NULL, IN, SOME/ANY, ALL, EXISTS.
- Expressions: Expressions are numeric or string values by itself, or the result of arithmetic or concatenation operators, or the result of functions.
- Object names: Names of database objects like tables, views, columns, functions.
- Values: Numeric or string values.
- Arithmetic operators: The plus sign, minus sign, asterisk and solidus (+, –, * and /) specify addition, subtraction, multiplication and division.
- Concatenation operator: The '||' sign specifies the concatenation of character strings.
- Comparison operators: The equals operator, not equals operator, less than operator, greater than operator, less than or equals operator, greater than or equals operator ( =, <>, <, >, <=, >= ) compares values and expressions.
- Boolean operators: AND, OR, NOT combines boolean values.