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
550 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 ==> | Basic joins (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.
If you haven't already done so, run the script in the above folder to generate the Doctor Who database.
Write a query using inner joins to show all of the authors who have written episodes featuring the Daleks. You may find the following relationship diagram useful to refer to:
How to get from enemies to authors in 3 easy jumps.
You should find that there are 16 such episodes!
When you've finished, save this as Enough joins for now, then close it down.
You can find other training resources for the subject of this exercise here:
From: | Devender |
When: | 15 Jan 24 at 06:47 |
/*Write a query using inner joins to show all of the authors who have written episodes featuring the Daleks.
You may find the following relationship diagram useful to refer to:
*/
select a.authorname , t.title, e.enemyname from tblAuthor a
inner join tblEpisode t on a.AuthorId= t.authorid
inner join tblEpisodeEnemy ee on ee.EpisodeId=t.EpisodeId
inner join tblEnemy e on e.EnemyId=ee.EnemyId
where EnemyName ='Daleks'
From: | sipi41 |
When: | 15 May 22 at 20:32 |
The exercise says: LIST AUTHORS
select a.AuthorId, a.AuthorName
from tblAuthor a
inner join tblEpisode e
on a.AuthorId = e.AuthorId
inner join [tblEpisodeEnemy] EpEn
on EpEn.EpisodeId = E.EpisodeId
inner join [tblEnemy] enemy
on enemy.EnemyId = EpEn.EnemyId
WHERE enemy.EnemyName LIKE 'Daleks'
GROUP BY a.AuthorId, a.AuthorName
From: | Miller |
When: | 18 Dec 18 at 20:31 |
select [EpisodeEnemyId], e.[EnemyName],[EpisodeNumber],[AuthorName]
from [dbo].[tblEpisodeEnemy] as epe
inner join [dbo].[tblEnemy] as e
on epe.EnemyId= e.EnemyId
inner join [dbo].[tblEpisode] as e1
on epe.EpisodeId = e1.EpisodeId
inner join [dbo].[tblAuthor] as a
on e1.AuthorId= a.AuthorId
where EnemyName like '%Daleks%'
From: | LACubico |
When: | 25 Sep 18 at 15:35 |
Use inner joins to link four tables to show Dr Who enemies by author.
USE DoctorWho
select a.AuthorId,a.AuthorName,
b.Title,b.episodetype,
c.EnemyId, d.EnemyName
from tblAuthor as a
inner join tblEpisode as b on
a.AuthorId = b.AuthorId
inner join tblEpisodeEnemy as c on
c.EpisodeId = b.EpisodeId
inner join tblEnemy as d on
d.EnemyId = c.EnemyId
where d.EnemyName = 'Daleks'
From: | grao |
When: | 05 Nov 17 at 18:42 |
So is this the code?
use doctorwho
Select authorname
from tblauthor as a
inner join tblepisode as epi
on a.authorid = epi.authorid
inner join tblepisodeenemy as ene
on epi.episodeid = ene.episodeenemyid
inner join tblenemy as enemy
on enemy.enemyid = ene.episodeenemyid
where title like '%Daleks%'
From: | bhilarev |
When: | 25 Oct 17 at 07:14 |
I just get only four rows ,
Select
x.AuthorName,y.EpisodeNumber,y.Title,y.EpisodeDate
From Author As x
INNER JOIN Episode As y
ON x.AuthorId = y.AuthorId
Where Title Like '%Daleks%';
Is this query correct?
From: | Andy B |
When: | 25 Oct 17 at 08:44 |
You're showing all the episodes whose titles contain the word Dalek, rather than all episodes which feature the Daleks. So for example an episode entitled "Little tin men from space" might feature the Daleks, but wouldn't appear in your query.
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.