Step 1: Select rows where 'directed_by' is not null.
unnamed__0 |
title |
directed_by |
written_by |
viewers |
original_airdate |
prod_code |
1 |
fathers and sons |
mike clattenburg |
allan hawco , perry chafe and malcolm macrury |
969000 |
2010-01-06 |
101 |
2 |
the return of the grievous angel |
steve dimarco |
allan hawco and avrum jacobson |
715000 |
2010-01-13 |
102 |
3 |
duchess of george |
mike clattenburg |
allan hawco , perry chafe and malcolm macrury |
685000 |
2010-01-20 |
103 |
5 |
hit and rum |
steve dimarco |
matt maclennan |
594000 |
2010-02-03 |
105 |
6 |
the one who got away |
larry mclean |
jesse mckeown |
1012000 |
2010-02-10 |
106 |
7 |
the woman who knew too little |
robert lieberman |
jeremy boxen |
1053000 |
2010-03-03 |
107 |
8 |
the tell - tale safe |
jerry ciccoritti |
john callaghan and steve cochrane |
986000 |
2010-03-10 |
108 |
9 |
he sleeps with the chips |
phil earnshaw |
perry chafe |
908000 |
2010-03-17 |
109 |
10 |
the pen is mightier than the doyle |
robert lieberman |
steve cochrane and avrum jacobson |
897000 |
2010-03-24 |
110 |
11 |
a horse divided |
steve scaini |
jesse mckeown |
902000 |
2010-03-31 |
111 |
Step 2: Group the table by 'directed_by' and count the number of unique values in 'directed_by'.
unnamed__0 |
title |
directed_by |
written_by |
viewers |
original_airdate |
prod_code |
1 |
fathers and sons |
mike clattenburg |
allan hawco , perry chafe and malcolm macrury |
969000 |
2010-01-06 |
101 |
2 |
the return of the grievous angel |
steve dimarco |
allan hawco and avrum jacobson |
715000 |
2010-01-13 |
102 |
3 |
duchess of george |
mike clattenburg |
allan hawco , perry chafe and malcolm macrury |
685000 |
2010-01-20 |
103 |
5 |
hit and rum |
steve dimarco |
matt maclennan |
594000 |
2010-02-03 |
105 |
6 |
the one who got away |
larry mclean |
jesse mckeown |
1012000 |
2010-02-10 |
106 |
7 |
the woman who knew too little |
robert lieberman |
jeremy boxen |
1053000 |
2010-03-03 |
107 |
8 |
the tell - tale safe |
jerry ciccoritti |
john callaghan and steve cochrane |
986000 |
2010-03-10 |
108 |
9 |
he sleeps with the chips |
phil earnshaw |
perry chafe |
908000 |
2010-03-17 |
109 |
10 |
the pen is mightier than the doyle |
robert lieberman |
steve cochrane and avrum jacobson |
897000 |
2010-03-24 |
110 |
11 |
a horse divided |
steve scaini |
jesse mckeown |
902000 |
2010-03-31 |
111 |
Step 3: Use a `CASE` statement to return TRUE if the number of unique values is equal to the number of rows, otherwise return FALSE.
directed_by |
unique_directors |
jerry ciccoritti |
1 |
larry mclean |
1 |
mike clattenburg |
1 |
phil earnshaw |
1 |
robert lieberman |
1 |
steve dimarco |
1 |
steve scaini |
1 |
Prediction: TRUE