Step 1: Extract the month and year from the 'air_date' column then add columns 'month' and 'year' to the existing table.
| episode |
air_date |
timeslot |
c_18___49 |
viewers |
| pilot |
2008-09-24 |
wednesday 8:30 pm |
2.3 / 6 |
6.84 |
| gary gets boundaries |
2008-10-01 |
wednesday 8:30 pm |
2.2 / 6 |
6.97 |
| gary marries off his ex |
2008-10-08 |
wednesday 8:30 pm |
2.2 / 6 |
7.43 |
| gary gets his stuff back |
2008-10-15 |
wednesday 8:30 pm |
2.4 / 7 |
7.71 |
| gary breaks up his ex - wife and girlfriend |
2008-10-22 |
wednesday 8:30 pm |
2.5 / 7 |
7.85 |
| gary meets the gang |
2008-11-05 |
wednesday 8:30 pm |
2.1 / 6 |
6.44 |
| gary and allison 's restaurant |
2008-11-12 |
wednesday 8:30 pm |
2.1 / 5 |
6.71 |
| gary and allison brooks |
2008-11-19 |
wednesday 8:30 pm |
2.7 / 7 |
8.14 |
| gary gives thanks |
2008-11-26 |
wednesday 8:30 pm |
2.2 / 7 |
7.72 |
| gary goes first |
2008-12-10 |
wednesday 8:30 pm |
2.4 / 7 |
8.03 |
| gary toughens up tom |
2008-12-17 |
wednesday 8:30 pm |
2.3 / 7 |
7.55 |
| gary dates louise 's teacher |
2009-01-14 |
wednesday 8:30 pm |
2.1 / 5 |
7.07 |
| gary moves back in |
2009-01-21 |
wednesday 8:30 pm |
2.2 / 5 |
7.07 |
| gary and dennis' sister |
2009-02-11 |
wednesday 8:30 pm |
2.1 / 5 |
6.86 |
| gary 's ex - brother - in - law |
2009-02-18 |
wednesday 8:30 pm |
2.1 / 5 |
7.26 |
| gary uses his veto |
2009-03-11 |
wednesday 8:30 pm |
2.3 / 7 |
7.71 |
| gary hooks up allison |
2009-03-18 |
wednesday 8:30 pm |
2.3 / 7 |
7.57 |
| gary and the trophy |
2009-04-08 |
wednesday 8:30 pm |
2.2 / 7 |
7.3 |
| gary and his half brother |
2009-05-06 |
wednesday 8:30 pm |
2.0 / 6 |
6.66 |
| gary fixes allison 's garbage disposal |
2009-05-20 |
wednesday 8:30 pm |
1.7 / 5 |
5.55 |
Step 2: Select rows where the 'month' is equal to 12 and the 'year' is equal to 2009.
| episode |
air_date |
timeslot |
c_18___49 |
viewers |
month |
year |
| pilot |
2008-09-24 |
wednesday 8:30 pm |
2.3 / 6 |
6.84 |
09 |
2008 |
| gary gets boundaries |
2008-10-01 |
wednesday 8:30 pm |
2.2 / 6 |
6.97 |
10 |
2008 |
| gary marries off his ex |
2008-10-08 |
wednesday 8:30 pm |
2.2 / 6 |
7.43 |
10 |
2008 |
| gary gets his stuff back |
2008-10-15 |
wednesday 8:30 pm |
2.4 / 7 |
7.71 |
10 |
2008 |
| gary breaks up his ex - wife and girlfriend |
2008-10-22 |
wednesday 8:30 pm |
2.5 / 7 |
7.85 |
10 |
2008 |
| gary meets the gang |
2008-11-05 |
wednesday 8:30 pm |
2.1 / 6 |
6.44 |
11 |
2008 |
| gary and allison 's restaurant |
2008-11-12 |
wednesday 8:30 pm |
2.1 / 5 |
6.71 |
11 |
2008 |
| gary and allison brooks |
2008-11-19 |
wednesday 8:30 pm |
2.7 / 7 |
8.14 |
11 |
2008 |
| gary gives thanks |
2008-11-26 |
wednesday 8:30 pm |
2.2 / 7 |
7.72 |
11 |
2008 |
| gary goes first |
2008-12-10 |
wednesday 8:30 pm |
2.4 / 7 |
8.03 |
12 |
2008 |
| gary toughens up tom |
2008-12-17 |
wednesday 8:30 pm |
2.3 / 7 |
7.55 |
12 |
2008 |
| gary dates louise 's teacher |
2009-01-14 |
wednesday 8:30 pm |
2.1 / 5 |
7.07 |
01 |
2009 |
| gary moves back in |
2009-01-21 |
wednesday 8:30 pm |
2.2 / 5 |
7.07 |
01 |
2009 |
| gary and dennis' sister |
2009-02-11 |
wednesday 8:30 pm |
2.1 / 5 |
6.86 |
02 |
2009 |
| gary 's ex - brother - in - law |
2009-02-18 |
wednesday 8:30 pm |
2.1 / 5 |
7.26 |
02 |
2009 |
| gary uses his veto |
2009-03-11 |
wednesday 8:30 pm |
2.3 / 7 |
7.71 |
03 |
2009 |
| gary hooks up allison |
2009-03-18 |
wednesday 8:30 pm |
2.3 / 7 |
7.57 |
03 |
2009 |
| gary and the trophy |
2009-04-08 |
wednesday 8:30 pm |
2.2 / 7 |
7.3 |
04 |
2009 |
| gary and his half brother |
2009-05-06 |
wednesday 8:30 pm |
2.0 / 6 |
6.66 |
05 |
2009 |
| gary fixes allison 's garbage disposal |
2009-05-20 |
wednesday 8:30 pm |
1.7 / 5 |
5.55 |
05 |
2009 |
Step 3: Use a `CASE` statement to return TRUE if the number of rows is equal to 0, otherwise return FALSE.
| episode |
air_date |
timeslot |
c_18___49 |
viewers |
month |
year |