A typical SQL request consists of the following:
- A statement keyword
- One or more column names
- A database name
- A table name
- One or more optional clauses introduced by keywords
For example, in the following single-statement request, the statement keyword is SELECT:
SELECT deptno, name, salary FROM personnel.employee WHERE deptno IN(100, 500) ORDER BY deptno, name ;
The select list and FROM clause for this statement is made up of the following names:
- Deptno, name, and salary (the column names)
- Personnel (the database name)
- Employee (the table name)
The search condition, or WHERE clause, is introduced by the keyword WHERE, as in:
WHERE deptno IN(100, 500)
The sort ordering, or ORDER BY clause, is introduced by the keywords ORDER BY, as in:
ORDER BY deptno, name