Sunday, October 14, 2012

WHERE Clause || ORDER BY Clause || GROUP BY Clause

                This clause is used to check the condition, based on the condition we can retrieve the specific record (or) we can modify the specific records in the table. 

Update-Where :
Syntax : Update <Table_Name> set Column_name=value where condition; 

Delete-Where : 
Syntax : Delete from <table_name> where condition; 

Select-Where : 
Syntax: Select * from <table_name> where condition; 

ORDER BY Clause:
                   This clause is used to arrange the data either in ascending order (or) descending order. By default ascending order. If we apply order by clause in character columns then it will arrange the data in alphabetical order. We can apply order by clause on more than one column on the table. 

Syntax: select * from <Table_Name> order by  <Column_Name>
Example :

Group by Clause:
                   This function groups the values depending on its nature. This is always used on group functions only.
Example: select count(*),deptno from emp group by deptno;

  • Having is used with group by clause to give the condition. 

Example: select count(*),deptno from emp group by deptno having count(*)>5;

No comments:

Post a Comment

back to top