ORDER BY

 

USING ORDER BY

(This will be used to ordering the columns data (ascending or descending).

By default oracle will use ascending order.

If you want output in descending order you have to use desc keyword after the column.)

Syntax: Select * from <table_name> order by <col> desc;
Ex: SQL> select * from student order by no;

NO NAME            MARKS

—  ——-           ———

1   Sudha             100

1   Zahir              300

2   Shaikat            200s

2   Nipu             400

3   Rahim

4   Maruf

5   Rony

6   Rasel

SQL> select * from student order by no desc;

NO NAME            MARKS

—  ——-           ———

6 Rasel

5 Rony

4 Maruf

3 Rahim

2 Shaikat            200

2 Nipu             400

1 Sudha             100

1 Zahir             300

Questions