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
551 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 ==> | Relatively easy |
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.
If you haven't already done so, run the script in the above folder to generate the Doctor Who database.
The following diagram shows how the authors and episodes tables are related:
You're probably familiar with this by now!
Use this to show for each author:
If you sort these so that the most prolific authors come first, here are the first few of the 25 rows you should see:
Those who know their Doctor Who won't be surprised at the two leaders.
Save this query as Blink was the best, then close it down.
You can find other training resources for the subject of this exercise here:
From: | Wise Owl 2 |
When: | 08 Nov 21 at 13:23 |
with aut as (
select count(title) as [Number of episodes wrote],AuthorId from tblEpisode
group by AuthorId
)
select a.Authorname,b.[Number of episodes wrote],max(c.episodeDate) as [Latest Episode Date],min(c.episodedate) as [Earliest Episode Date] from tblAuthor a
inner join aut b on a.AuthorId=b.authorId
inner join tblEpisode c on a.AuthorId=c.AuthorId
group by AuthorName,[Number of episodes wrote]
order by [Number of episodes wrote] desc
From: | walteragwe |
When: | 21 Jan 21 at 02:47 |
SELECT [AuthorName], COUNT([EpisodeId]) AS [# OF EPISODES],
MIN([EpisodeDate]) AS [Earliest epi Date],
max([EpisodeDate]) as [latest epi Date]
FROM [dbo].[tblAuthor] AS A INNER JOIN [dbo].[tblEpisode] AS E
ON A.AuthorId = E.AuthorId
GROUP BY [AuthorName]
order by [# OF EPISODES] desc;
GO
From: | shahnawaz |
When: | 20 Jul 20 at 12:22 |
select AuthorName, count(EpisodeNumber), EpisodeDate as [Earliest date], EpisodeDate as [Latest date] from
tblAuthor INNER JOIN tblEpisode ON tblAuthor.AuthorId=tblEpisode.AuthorId
group by AuthorName, EpisodeDate
order by [Earliest date] asc, [Latest date] desc
What is the problem with my code?
From: | Dintakurthi |
When: | 19 Nov 20 at 07:27 |
SELECT a.AuthorName,COUNT(a.AuthorId) AS Episodes,MIN(B.EpisodeDate) AS EarlistDate,MAX(B.EpisodeDate) AS LatestDate from tblAuthor a
INNER JOIN tblEpisode b on b.AuthorId=a.AuthorId
GROUP BY a.AuthorName,a.AuthorId
ORDER BY a.AuthorName ASC
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.