2. Some simple SQL Select statements: Step 7

Demo

Ordering the rows of the output

The output can be sorted by using the order by clause in the select statement. For example, to show the name and employee number in alphabetical order by name:

SQL

SELECT ename,empno FROM emp ORDER BY ename;

Output

ename empno
ADAMS 7876
ALLEN 7499
BLAKE 7698
CLARK 7782
FORD 7902
JAMES 7900
JONES 7566
KING 7839
MARTIN 7654
MILLER 7934
SCOTT 7788
SMITH 7369
TURNER 7844
WARD 7521

Progress

Proceed to Next step