APPX Software Library

Chapter 4: SQL Language Elements

SQL Language Elements: overview

This chapter describes language elements that are common to many SQL statements. Syntax diagrams in other chapters often refer to these language elements without detailed explanation. The major syntax elements described in the following sections are:

Identifiers (page 4-3) are user-supplied names for elements such as tables, views, cursors, and columns. SQL statements use those names to refer to the elements.

Data types (page 4-4) control how SQL stores column values. CREATE TABLE statements specify data types for columns.

Query expressions (page 4-13) retrieve values from tables. Query expressions form the basis of other SQL statements and syntax elements

Search conditions (page 4-24) specify a condition that is true or false about a given row or group of rows. Query expressions and UPDATE statements specify search conditions to restrict the number of rows in the result table.

Expressions (page 4-30) are a symbol or string of symbols used to represent or calculate a single value in an SQL statement. When SQL encounters an expression, it retrieves or calculates the value represented by the expression and uses that value when it executes the statement.

Literals (page 4-35) are a type of SQL expression that specify a constant value. Some SQL constructs allow literals but prohibit other forms of expressions.

Date-time format strings (page 4-40) control the output of date and time values. Dharma/SQL interprets format strings and replaces them with formatted values.

Functions (page 4-43) are a type of SQL expression that return a value based on the argument they are supplied. Aggregate functions calculate a single value for a collection of rows in a result table. Scalar functions calculate a value based on another single value.