SQL ORDER BY - Introduction and syntax
Explain the SQL ORDER BY statement. Write SQL syntax for the SQL ORDER BY
statement along with an example.
ORDER BY: It is used to sort columns of a result set. It sorts
columns in ascending order by default. DESC can be used to sort in a descending
order.
Syntax:
SELECT column_name(s) FROM table_name ORDER BY column_name(s) ASC|DESC
Example:
SELECT balance FROM Account ORDER BY balance DESC
WHERE: It is used to fetch records that fulfill a specified
condition.................
SQL SELECT INTO: The SELECT INTO statement selects data from one table and
inserts it into a different table. Used often for creating back
up’s............
SQL NOT NULL: The NOT NULL constraint enforces a column to NOT accept NULL
values..............
LIKE clause is used for pattern matching. % is used to match any string of any
length where as _ allows you to match on a single character................
The IN operator allows you to specify multiple values in a WHERE
clause................
|