Skip to content
Tako Lee edited this page Feb 22, 2014 · 7 revisions

Before set coding style for SQL, it's helpful to have a high view of SQL.

  • SQL script Consists of one of more SQL statement, Typically, it was saved in a file.

  • SQL statement

  • SQL block Block can be nested, such as BEGIN/END, IF/ELSE, or TRY/CATCH

  • SQL clause

    SQL statement is made up of different clauses. For example, SELECT statement consist of select list, from clause, where clause, group by and etc. Each clause has same structure like this:

      <MAIN KEYWORD> [options] <arguments>

    Take this select list for example:

      SELECT top 10 name, department, location

    SELECT is main keyword, top 10 is option, name, department, location is arguments.

    WHERE salary > 1000

    WHERE is main keyword, salary > 1000 is argument.

  • SQL subquery Subquery is a special form of select statement can be occurs in different parts of a statement.

  • SQL expression

Clone this wiki locally