Group By:- Group By clauses is used to groups rows based on the distinct values of the specified columns.
The syntax of the Group by clause is:-
Select column1, column2, column3, aggregate_function(expression )
From TableName Where (condition)
Group By Column1, column2, column3
For Example, suppose we have a table named EmpInfo which contains the information about the Id of the employee and the Id of the project and it contains the following data
Table:- EmpInfo
EmployeeId Projectid
————————–
1 1
2 2
3 2
4 2
5 3
Now suppose we want to know about the number of employee belonging to each project then we can use the group by clause as given below:-
select Projectid , count(employeeid) as NumberOfEmployee from EmpInfo Group by ProjectId
This query will give us the following result:-
ProjectId NumberOfEmployee
1 1
2 3
3 1
Having Clause :- Having clause is used in conjunction with the group clause by imposing a condition on the group by clause to further filter the records return by the group by clause.
Syntax for Having Clause:-
Select column1, column2, column3, aggregate_function(expression )
From TableName Where (condition)
Group By Column1, column2, column3
having aggregate_function(expression ) operator value
For example, suppose we want to know which project has more than 2 employee and the total no of their respective employees, we can use the following query
select Projectid , count(employeeid) as NumberOfEmployee from EmpInfo Group by ProjectId having count(employeeid) >2
The query will give us the following result:-
ProjectId NumberOfEmployee
2 3
In the above example, the Having clause further filter the result return by the Group By clause by imposing a condition that only those projectid will be shown who has more than 2 employee.
thank you
… [Trackback]
[…] Info to that Topic: techmixing.com/2010/01/group-byhaving-clause.html […]
… [Trackback]
[…] Here you can find 95501 more Information on that Topic: techmixing.com/2010/01/group-byhaving-clause.html […]
… [Trackback]
[…] Find More Information here to that Topic: techmixing.com/2010/01/group-byhaving-clause.html […]
… [Trackback]
[…] Find More to that Topic: techmixing.com/2010/01/group-byhaving-clause.html […]
… [Trackback]
[…] Read More here to that Topic: techmixing.com/2010/01/group-byhaving-clause.html […]
… [Trackback]
[…] Read More to that Topic: techmixing.com/2010/01/group-byhaving-clause.html […]
… [Trackback]
[…] Information to that Topic: techmixing.com/2010/01/group-byhaving-clause.html […]
… [Trackback]
[…] Info on that Topic: techmixing.com/2010/01/group-byhaving-clause.html […]
… [Trackback]
[…] Here you will find 52576 additional Info on that Topic: techmixing.com/2010/01/group-byhaving-clause.html […]
… [Trackback]
[…] Read More here on that Topic: techmixing.com/2010/01/group-byhaving-clause.html […]
… [Trackback]
[…] Here you can find 33623 more Info to that Topic: techmixing.com/2010/01/group-byhaving-clause.html […]
… [Trackback]
[…] Find More Info here on that Topic: techmixing.com/2010/01/group-byhaving-clause.html […]
… [Trackback]
[…] Read More on to that Topic: techmixing.com/2010/01/group-byhaving-clause.html […]
… [Trackback]
[…] Read More on that Topic: techmixing.com/2010/01/group-byhaving-clause.html […]
… [Trackback]
[…] Information on that Topic: techmixing.com/2010/01/group-byhaving-clause.html […]
… [Trackback]
[…] Information on that Topic: techmixing.com/2010/01/group-byhaving-clause.html […]
… [Trackback]
[…] Info on that Topic: techmixing.com/2010/01/group-byhaving-clause.html […]
[…] Find 55048 More Information here to that Topic: techmixing.com/2010/01/group-byhaving-clause.html […]
… [Trackback]
[…] Info to that Topic: techmixing.com/2010/01/group-byhaving-clause.html […]
… [Trackback]
[…] Information to that Topic: techmixing.com/2010/01/group-byhaving-clause.html […]
… [Trackback]
[…] Find More on that Topic: techmixing.com/2010/01/group-byhaving-clause.html […]
… [Trackback]
[…] Here you can find 59120 additional Information on that Topic: techmixing.com/2010/01/group-byhaving-clause.html […]
… [Trackback]
[…] Read More on that Topic: techmixing.com/2010/01/group-byhaving-clause.html […]
… [Trackback]
[…] Here you will find 18685 additional Info on that Topic: techmixing.com/2010/01/group-byhaving-clause.html […]
… [Trackback]
[…] Read More on on that Topic: techmixing.com/2010/01/group-byhaving-clause.html […]
… [Trackback]
[…] Here you will find 24819 more Info on that Topic: techmixing.com/2010/01/group-byhaving-clause.html […]
movies
movies
movies online
movies online
karan johar
karan johar
Top Movies
Top Movies
Movies1
Movies1
11 10 2019
11 10 2019
… [Trackback]
[…] Information to that Topic: techmixing.com/2010/01/group-byhaving-clause.html […]
smotretonline2015.ru
smotretonline2015.ru
Serial smotret
Serial smotret
kinokrad
kinokrad
kinokrad 2020
kinokrad 2020
ñïèñîê íîâûõ ôèëüìîâ
ñïèñîê íîâûõ ôèëüìîâ
Watch Tv Series Online
Watch Tv Series Online
casino
casino
Kinokrad 2019 Kinokrad Hd
Kinokrad 2019 Kinokrad Hd
filmy-kinokrad
filmy-kinokrad
kinokrad-2019
kinokrad-2019
filmy-2019-kinokrad
filmy-2019-kinokrad
serial
serial
cerialest.ru
cerialest.ru
dorama hdrezka
dorama hdrezka
movies hdrezka
movies hdrezka
HDrezka
HDrezka