-
Notifications
You must be signed in to change notification settings - Fork 13
SQL organisation
Different parts of SQL defined here was aimed to help formatting SQL in a consistent style.
-
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.
But not all clauses including main keyword, column definition in create table statement is such an example. it defines like this.
columnName datatype
-
SQL subquery
Subquery is a special form of select statement can be occurs in different parts of a statement.
-
SQL expression