You are on page 1of 1

The SQL ANY and ALL Operators

ANY and ALL are two most –important operators which are used with WHERE and HAVING clause. If
any subquery values meet the condition, the ANY operator returns true. If all operators meet the
conditions of the subquery, the ALL operators return true.However a standard comparision operator (=, !
=, >, < ,>=, <=) should be used as an operator.
ANY Syntax:

SELECT column_name(s)
FROM table_name
WHERE column_name operator ANY
(SELECT column_name  FROM table_name WHERE condition);
ALL Syntax:

SELECT column_name(s)
FROM table_name
WHERE column_name operator ALL
(SELECT column_name  FROM table_name  WHERE condition);

The SQL SELECT INTO Statement


In order to copy data from one table to a new table, SELECT INTO statement is a very efficient
statement.

SELECT INTO Syntax:


To copy all columns into a new table:

SELECT *
INTO newtable [IN externaldb]
FROM oldtable
WHERE condition;
To copy only some columns into a new table:

SELECT column1, column2, column3,...
INTO newtable [IN externaldb]
FROM oldtable
WHERE condition;

You might also like