SQL Getting Started

Order of Operations

It is important to take into account the order of operations. The output from one clause is the input to the next one, as stated in the list below. An example where order of operations is a consideration is presented in Naming Expressions.

The following sequence of operations is not necessarily the way that the operations are performed within the DB2 code. This simple explanation merely allows for a more intuitive means of thinking about queries. The sequence of operations is as follows:

  1. FROM clause
  2. WHERE clause
  3. GROUP BY clause
  4. HAVING clause
  5. SELECT clause
  6. ORDER BY clause


[ Top of Page | Previous Page | Next Page ]