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.
April 30, 2008
SQL interview- "ORDER BY" clause in "select statement"
Subscribe to:
Post Comments (Atom)
2 Comments:
what purpose we use sql in testing
For database testing we needs SQL.
Post a Comment