Use of order by statement.
The ORDER BY keyword is used to sort the result-set in ascending or descending order. The ORDER BY keyword sorts the records in ascending order by default. To sort the records in descending order, use the DESC keyword.
Syntax*
SELECT column1, column2, ... FROM table_name ORDER BY column1, column2, ... ASC|DESC;QUERY*
CREATE TABLE stud_113 (Rollno NUMBER(5), name VARCHAR(10), address VARCHAR(15),As Shown in Fig...7.1
phoneno NUMBER(10), age NUMBER(5));
Output QUERY*
INSERT INTO stud_113 VALUES(3); INSERT INTO stud_113 VALUES(2); INSERT INTO stud_113 VALUES(5); INSERT INTO stud_113 VALUES(4); INSERT INTO stud_113 VALUES(1); INSERT INTO stud_113 VALUES(6);As Shown in Fig...7.2
Output QUERY*
SELECT * FROM stud_113 ORDER BY rollno DESC;As Shown in Fig...7.3
Output
Comments
Post a Comment