Table: red_dwarf_ratings
Columns: episode_no
airdate
dave_viewers
dave_rank
rank_cable
dave_ja_vu_viewers
total_viewers

Question: Which episode number aired on 18 october 2012?
SQL: SELECT MIN("episode_no") FROM red_dwarf_ratings WHERE "airdate" = '18 October 2012'

Question: What is the lowest cable rank of an episode with 1464000 viewers?
SQL: SELECT MIN("rank_cable") FROM red_dwarf_ratings WHERE "total_viewers" = 1464000

Question: What is the highest number of dave viewers of an episode with 119000 dave ja vu viewers?
SQL: SELECT MAX("dave_viewers") FROM red_dwarf_ratings WHERE "dave_ja_vu_viewers" = 119000

Question: How many episodes aired on 25 october 2012?
SQL: SELECT COUNT("total_viewers") FROM red_dwarf_ratings WHERE "airdate" = '25 October 2012'

Question: What was the airdate of the episode with 106000 dave ja vu viewers?
SQL: SELECT "airdate" FROM red_dwarf_ratings WHERE "dave_ja_vu_viewers" = 106000