Read our blogs, tips and tutorials
Try our exercises or test your skills
Watch our tutorial videos or shorts
Take a self-paced course
Read our recent newsletters
License our courseware
Book expert consultancy
Buy our publications
Get help in using our site
555 attributed reviews in the last 3 years
Refreshingly small course sizes
Outstandingly good courseware
Whizzy online classrooms
Wise Owl trainers only (no freelancers)
Almost no cancellations
We have genuine integrity
We invoice after training
Review 30+ years of Wise Owl
View our top 100 clients
Search our website
We also send out useful tips in a monthly email newsletter ...
Software ==> | SQL (203 exercises) |
Topic ==> | Aggregation and grouping (12 exercises) |
Level ==> | Average difficulty |
Subject ==> | SQL training |
This exercise is provided to allow potential course delegates to choose the correct Wise Owl Microsoft training course, and may not be reproduced in whole or in part in any format without the prior written consent of Wise Owl.
This will generate the database that you'll need to use in order to do this exercise (note that the database and script are only to be used for exercises published on this website, and may not be reused or distributed in any form without the prior written permission of Wise Owl).
Create a query listing out for each continent and country the number of events taking place therein:
The first few of the 42 rows you should get from this query, if you sort the results by country name.
You'll need to join the tblContinent, tblCountry and tblEvent tables. All good practice!
Now change your query so that it omits events taking place in the continent of Europe:
You should now be down to 25 rows.
Finally, change your query so that it only shows countries having 5 or more events:
You should now be down to 3 rows.
A thought: you should just have used every one of the SFWGHO letters!
Save your query as Post Brexit events, then close it down.
You can find other training resources for the subject of this exercise here:
From: | Bhavya59 |
When: | 01 Aug 24 at 12:50 |
SELECT ContinentName
,CountryName
,COUNT(EventID) AS 'No of Events'
FROM tblCountry c
INNER JOIN tblContinent c1 ON c.ContinentID=c1.ContinentID
INNER JOIN tblEvent e ON c.CountryID=e.CountryID
WHERE ContinentName!='Europe'
GROUP BY ContinentName,CountryName
HAVING COUNT(EventID)>5
From: | Rupchand7 |
When: | 14 Nov 23 at 06:16 |
select continentname as Continent, countryname as Country, count(eventid) as [Number of Events]
from tblContinent join tblCountry on tblContinent.ContinentID = tblCountry.ContinentID join
tblEvent on tblCountry.CountryID = tblEvent.CountryID group by Continentname, Countryname
select continentname as Continent, countryname as Country, count(eventid) as [Number of Events]
from tblContinent join tblCountry on tblContinent.ContinentID = tblCountry.ContinentID join
tblEvent on tblCountry.CountryID = tblEvent.CountryID where continentname != 'europe'
group by Continentname, Countryname
select continentname as Continent, countryname as Country, count(eventid) as [Number of Events]
from tblContinent join tblCountry on tblContinent.ContinentID = tblCountry.ContinentID join
tblEvent on tblCountry.CountryID = tblEvent.CountryID where continentname != 'europe'
group by Continentname, Countryname having count(eventid) >5
From: | FloridaMan |
When: | 23 Sep 21 at 14:40 |
select max(con.ContinentName) as Continent_Name
, cou.CountryName as Country_Name
, count(e.EventName) as Number_of_Events
from [dbo].[tblEvent] e
left join [dbo].[tblCategory] c
on e.CategoryID = c.CategoryID
left join [dbo].[tblCountry] cou
on e.CountryID = cou.CountryID
left join [dbo].[tblContinent] con
on cou.ContinentID = con.ContinentID
where ContinentName not in('Europe')
group by cou.CountryName
having count(e.EventName) >= 5
order by cou.CountryName
Kingsmoor House
Railway Street
GLOSSOP
SK13 2AA
Landmark Offices
99 Bishopsgate
LONDON
EC2M 3XD
Holiday Inn
25 Aytoun Street
MANCHESTER
M1 3AE
© Wise Owl Business Solutions Ltd 2024. All Rights Reserved.