Step 1: Select rows where the 'result' column contains the substring 'w' (indicating a win).
week |
date |
opponent |
result |
attendance |
1 |
1976-09-12 |
chicago bears |
l 10 - 3 |
54125 |
2 |
1976-09-19 |
atlanta falcons |
w 24 - 10 |
50840 |
3 |
1976-09-26 |
minnesota vikings |
l 10 - 9 |
77292 |
4 |
1976-10-03 |
green bay packers |
l 24 - 14 |
55041 |
5 |
1976-10-10 |
new england patriots |
w 30 - 10 |
60174 |
6 |
1976-10-17 |
washington redskins |
l 20 - 7 |
45908 |
7 |
1976-10-24 |
seattle seahawks |
w 41 - 14 |
61280 |
8 |
1976-10-31 |
green bay packers |
w 27 - 6 |
74992 |
9 |
1976-11-07 |
minnesota vikings |
l 31 - 23 |
46735 |
10 |
1976-11-14 |
new orleans saints |
l 17 - 16 |
42048 |
11 |
1976-11-21 |
chicago bears |
w 14 - 10 |
78042 |
12 |
1976-11-25 |
buffalo bills |
w 27 - 14 |
66875 |
13 |
1976-12-05 |
new york giants |
l 24 - 10 |
66069 |
14 |
1976-12-11 |
los angeles rams |
l 20 - 17 |
73470 |
Step 2: Use a `COUNT` function to count the number of rows from step 1 and add column 'win_count' to the existing table.
week |
date |
opponent |
result |
attendance |
2 |
1976-09-19 |
atlanta falcons |
w 24 - 10 |
50840 |
5 |
1976-10-10 |
new england patriots |
w 30 - 10 |
60174 |
7 |
1976-10-24 |
seattle seahawks |
w 41 - 14 |
61280 |
8 |
1976-10-31 |
green bay packers |
w 27 - 6 |
74992 |
11 |
1976-11-21 |
chicago bears |
w 14 - 10 |
78042 |
12 |
1976-11-25 |
buffalo bills |
w 27 - 14 |
66875 |
Step 3: Select rows where the 'win_count' is equal to 6.
week |
date |
opponent |
result |
attendance |
win_count |
2 |
1976-09-19 |
atlanta falcons |
w 24 - 10 |
50840 |
6 |
5 |
1976-10-10 |
new england patriots |
w 30 - 10 |
60174 |
6 |
7 |
1976-10-24 |
seattle seahawks |
w 41 - 14 |
61280 |
6 |
8 |
1976-10-31 |
green bay packers |
w 27 - 6 |
74992 |
6 |
11 |
1976-11-21 |
chicago bears |
w 14 - 10 |
78042 |
6 |
12 |
1976-11-25 |
buffalo bills |
w 27 - 14 |
66875 |
6 |
Step 4: Select rows where the 'result' column contains the substring 'l' (indicating a loss).
week |
date |
opponent |
result |
attendance |
win_count |
2 |
1976-09-19 |
atlanta falcons |
w 24 - 10 |
50840 |
6 |
5 |
1976-10-10 |
new england patriots |
w 30 - 10 |
60174 |
6 |
7 |
1976-10-24 |
seattle seahawks |
w 41 - 14 |
61280 |
6 |
8 |
1976-10-31 |
green bay packers |
w 27 - 6 |
74992 |
6 |
11 |
1976-11-21 |
chicago bears |
w 14 - 10 |
78042 |
6 |
12 |
1976-11-25 |
buffalo bills |
w 27 - 14 |
66875 |
6 |
Step 5: Use a `COUNT` function to count the number of rows from step 4 and add column 'loss_count' to the existing table.
week |
date |
opponent |
result |
attendance |
win_count |
Step 6: Select rows where the 'loss_count' is equal to 8.
week |
date |
opponent |
result |
attendance |
win_count |
loss_count |
Step 7: Use a `CASE` statement to return TRUE if the number of rows from step 3 and step 6 is equal to 1, otherwise return FALSE.
week |
date |
opponent |
result |
attendance |
win_count |
loss_count |