Database Reference
In-Depth Information
Operator
Description
IN
To specify multiple possible values for a column
WITH : Sometimes SQL statements can become very complex while dealing
with multiple tables and associated conditions. To make the SQL statement
easier to understand and process, the WITH clause is used before the
SELECT statement to define aliases for the expression that are referenced
multiple times within SELECT statements. Using the WITH clause, you can
apply a single command to the existing SELECT statements without modify-
ing these statements. The syntax of the WITH clause is shown in the follow-
ing example:
WITH [common_table_statements];
Example:
WITH myWithEx1 as (SELECT 1), myWithEx2
as (SELECT 2) INSERT into
SELECT * FROM myWithEx1 UNION ALL SELECT
* from myWithEx2;
In the previous example, we have defined two aliases, myWithEx1 and
myWithEx2 , which are referenced by the SELECT query as defined.
GROUP BY : The GROUP BY statement is used along with aggregate func-
tions such as COUNT() , AVG() , SUM() , MIN() , or MAX() , to group the res-
ults set by one or more columns defined in the SQL statement.
The syntax of the GROUP BY statement is as follows:
SELECT column_name,
aggregate_function(column_name)
Search WWH ::




Custom Search