SQL order by In this tutorial how to use the SQL order by clause with syntax and examples. SQL ORDER BY clause is used to sort the data or record using ASC | DESC. SQL ORDER BY sorts the records in ASC (ascending order) by default. syntax 1: SELECT column 1,column 2, .... column N FROM table_name ORDER BY column ...[ASC|DESC]; syntax 2: SELECT column 1,column 2, .... column N FROM table_name ORDER BY column ASC,column DESC; Here, we are created one table and named student_marks, and used order by to sort with marks and display it in the table. create table student_marks ( s_id int primary key, s_name varchar(20) not null, maths int , english int, physics int , chemistry int, Tamil int, social int ); Insert the records in the table using the INSERT INTO keyword. INSERT INTO: insert into student_marks values(101, 'Jack',25,52,35,85,45,55); insert into student_marks values(102, 'Rithvik',55,62,65...
DailyAspirants: Your hub for free web development tutorials, SEO tips, and programming guides covering Python, SQL, C#, and more.