A Gentle Introduction to


Pick an engine:

Scottish Parliament

The data includes all Members of the Scottish Parliament (MSPs) in 1999. Most MSPs belong to a political party. Some parties have a leader who is an MSP. There are two tables:

Name Party Constituency
Adam MSP, BrianSNPNorth East Scotland
Aitken MSP, BillConGlasgow
Alexander MSP, Ms WendyLabPaisley North
... Total number of records: 129
Code Name Leader
ConConservativeMcLetchie MSP, David
LabLabourDewar MSP, Rt Hon Donald
... Total number of records: 9

Selecting NULL values

Dealing with NULL.

1a One MSP was kicked out of the Labour party and has no party. Find him.
Why we cannot use =

1b Obtain a list of all parties and leaders.

1c Give the party and the leader for the parties which have leaders.

1d Obtain a list of all parties which have at least one MSP.

Outer joins.

2a Obtain a list of all MSPs by name, give the name of the MSP and the name of the party where available. Be sure that Canavan MSP, Dennis is in the list.

2b Obtain a list of parties together with the number of MSPs.

2c A list of parties with the number of MSPs; include parties with no MSPs.

Self joins are the topic for the next tutorial.