CREATE TABLE "ratings" (
  "season" text,
  "episodes" real,
  "first_airdate" text,
  "last_airdate" text,
  "nielsen_ranking" text
);

Question: Which season last aired on May 6, 1987?
SQL: SELECT "season" FROM "ratings" WHERE "last_airdate"='may 6, 1987';

Question: What is the Nielsen ranking for Season 8?
SQL: SELECT "nielsen_ranking" FROM "ratings" WHERE "season"='season 8';

Question: What was the first airdate or the season that had less than 24 episodes and a Nielsen ranking of #38?
SQL: SELECT "first_airdate" FROM "ratings" WHERE "episodes"<24 AND "nielsen_ranking"='#38';

Question: How many episodes were in the season that first aired on September 22, 1989?
SQL: SELECT "episodes" FROM "ratings" WHERE "first_airdate"='september 22, 1989';

Question: How many episodes were in the season that ended on April 29, 1986?
SQL: SELECT AVG("episodes") FROM "ratings" WHERE "last_airdate"='april 29, 1986';