Order by clause: Order by clause is used to sort the query results. The syntax format is as follows: Order by attribute name [ASC | DESC] [, attribute name [ASC | DESC],...]
For example:
Select * From locan order by branch-name DESC, loan-Number
The group by clause groups tuples based on the values of one or more attributes. Clustering functions can apply to different groups.
Select branch-name sum (balance) as summary from account group by branch-name
Having clauses are mainly used to restrict conditions for groups. The predicates in a having clause take effect only after the group is formed. Therefore, clustering functions can be used in a having clause. Generally, the having clause is only used in the SQL statement of the Group by clause to remove groups that do not meet the specified conditions. For example:
Select branch-name, sum (balance) as summary from account group by branch-name having AVG (balance)> 1200