Table: ugly_betty_episodes_2
Columns: episode
title
air_date
rating
share
18_49
viewers
rank

Question: What is the total number of Viewers when the rank is #40?
SQL: SELECT COUNT("viewers") FROM ugly_betty_episodes_2 WHERE "rank" = '#40'

Question: What is the average Episode # with a share of 9, and #35 is rank and less than 8.21 viewers?
SQL: SELECT AVG("episode") FROM ugly_betty_episodes_2 WHERE "share" = 9 AND "rank" = '#35' AND "viewers" < 8.21

Question: What is the average Episode # with a 7 share and 18–49 is less than 2 and the Air Date of may 21, 2009?
SQL: SELECT AVG("episode") FROM ugly_betty_episodes_2 WHERE "share" = 7 AND "18_49" < 2 AND "air_date" = 'may 21, 2009'

Question: What is the lowest Viewers that has an Episode #higher than 58 with a title of "curveball" less than 4.1 rating?
SQL: SELECT MIN("viewers") FROM ugly_betty_episodes_2 WHERE "episode" > 58 AND "title" = '"curveball"' AND "rating" < 4.1

Question: What is the Air Date that has a 18–49 larger than 1.9, less than 7.54 viewers and a rating less than 4.9?
SQL: SELECT "air_date" FROM ugly_betty_episodes_2 WHERE "18_49" > 1.9 AND "viewers" < 7.54 AND "rating" < 4.9