Thursday, August 16, 2012

SQL “Group by” Clause syntax capability?

Answer:

 

Let us assume that we have the following table of Tourist with their respective rows,columns and data.



Assuming the above table, we have to display the total number of tourists from the different part of the countries.
In order to achieve the required result we have to use SQL “Group by” clause.
Query: -
select T1.TouristCountry,count(T1.TouristName) as NumberOfTourist from 
Tourist T1 group by T1.TouristCountry
Output: -

Hence you can see that the total number of tourist belongs from different countries has been displayed.

No comments:

Post a Comment