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.
You will be also interested in watching the below video: -
Asked In: Many Interviews |
Alert Moderator