Language Elements

Structured Query Language · Wikibooks

0%

Contents

    Text

    Size
    100%
    Theme
    Typeface
    Line length
    Spacing

    From Wikibooks, under CC BY-SA 4.0, as the source states it. This page at Wikibooks.

    Language Elements


    SQL consists of statements that start with a keyword like SELECT, DELETE or CREATE and terminate with a semicolon. Their elements are case-insensitive except for fixed character string values like 'Mr. Brown'.

    Illustration
    An example of a complete statement with several of its language elements.


    • Clauses: Statements are subdivided into clauses. The most popular one is the WHERE clause.
    • Predicates: Predicates specify conditions that 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.