Firebird 2.5 Language Reference → Firebird 2.5 Language Reference → SQL Language Structure → Basic Elements: Statements, Clauses, Keywords |
The primary construct in SQL is the statement. A statement defines what the database management system should do with a particular data or metadata object. More complex statements contain simpler constructs—clauses and options.
Clauses: A clause defines a certain type of directive in a statement. For instance, the WHERE clause in a SELECT statement and in some other data manipulation statements (UPDATE, DELETE) specifies criteria for searching one or more tables for the rows that are to be selected, updated or deleted. The ORDER BY clause specifies how the output data —result set— should be sorted.
Options: Options, being the simplest constructs, are specified in association with specific keywords to provide qualification for clause elements. Where alternative options are available, it is usual for one of them to be the default, used if nothing is specified for that option. For instance, the SELECT statement will return all of the rows that match the search criteria unless the DISTINCT option restricts the output to non-duplicated rows.
Keywords: All words that are included in the SQL lexicon are keywords. Some keywords are reserved, meaning their usage as identifiers for database objects, parameter names or variables is prohibited in some or all contexts. Non-reserved keywords can be used as identifiers, although it is not recommended. From time to time, non-reserved keywords may become reserved when some new language feature is introduced.
For instance, the following statement will be executed without errors because, although ABS is a keyword, it is not a reserved word.
CREATE TABLE T (ABS INT NOT NULL);On the contrary, the following statement will return an error because ADD is both a keyword and a reserved word.
CREATE TABLE T (ADD INT NOT NULL);
Refer to the list of reserved words and keywords in the chapter Reserved Words and Keywords.
Firebird 2.5 Language Reference → Firebird 2.5 Language Reference → SQL Language Structure → Basic Elements: Statements, Clauses, Keywords |