Data Query Language: Where clause, Order by, Group by

26/10/2022 0 By indiafreenotes

Where clause

The WHERE clause is used to filter records.

It is used to extract only those records that fulfill a specified condition.

WHERE Syntax

  • SELECT column1, column2, …

  • FROM table_name

  • WHERE condition;

Order by

Syntax of Order By in SQL:

  • SELECT column1, column2….
  • FROM table_name
  • ORDER BY column1 ASC/DESC, column2 ASC/DESC;


Sort all the students in ascending order in SQL by the “marks” column.

  • SELECT Name

  • FROM Student_details

  • ORDER BY Roll_no ASC;

Group by

It is used to arrange similar data into the group. The GROUP BY clause follows the WHERE clause and comes before the ORDER BY clause.

  • SELECT Name, Sum(marks)
  • FROM Student_details
  • GROUP BY Name;