April 30, 2008

SQL interview- "ORDER BY" clause in "select statement"

If you want the returning rows to be sorted, you can specify a sorting expression in the ORDER BY clause. The following select statement returns rows sorted by the values in the "E-mail" column.

SELECT * FROM departments ORDER BY E-mail;

You can specifying multiple columns in the ORDER BY clause.

SELECT department_id, first_name, last_name, salary
FROM employees ORDER BY E-mail, salary;

If you want to sort column in descending order, you can specify the DESC keyword in the ORDER BY clause.


radha said...

what purpose we use sql in testing

Brijesh said...

For database testing we needs SQL.

Search Here...

Popular Posts

Quick Test Professional