Database: candidate_poll

Question: Which poll resource provided the most number of candidate information?
SQL: SELECT poll_source FROM candidate GROUP BY poll_source ORDER BY count(*) DESC LIMIT 1

Question: what are the top 3 highest support rates?
SQL: SELECT support_rate FROM candidate ORDER BY support_rate DESC LIMIT 3

Question: Find the id of the candidate who got the lowest oppose rate.
SQL: SELECT Candidate_ID FROM candidate ORDER BY oppose_rate LIMIT 1

Question: which poll source does the highest oppose rate come from?
SQL: SELECT poll_source FROM candidate ORDER BY oppose_rate DESC LIMIT 1

Question: Find the average height and weight for all males (sex is M).
SQL: SELECT avg(height) ,  avg(weight) FROM people WHERE sex  =  'M'

Question: find the names of people who are taller than 200 or lower than 190.
SQL: SELECT name FROM people WHERE height  >  200 OR height  <  190

Question: Find the average and minimum weight for each gender.
SQL: SELECT avg(weight) ,  min(weight) ,  sex FROM people GROUP BY sex

Question: Find the name and gender of the candidate who got the highest support rate.
SQL: SELECT t1.name,  t1.sex FROM people AS t1 JOIN candidate AS t2 ON t1.people_id  =  t2.people_id ORDER BY t2.support_rate DESC LIMIT 1

Question: Find the name of the candidates whose oppose percentage is the lowest for each sex.
SQL: SELECT t1.name ,  t1.sex ,  min(oppose_rate) FROM people AS t1 JOIN candidate AS t2 ON t1.people_id  =  t2.people_id GROUP BY t1.sex

Question: which gender got the highest average uncertain ratio.
SQL: SELECT t1.sex FROM people AS t1 JOIN candidate AS t2 ON t1.people_id  =  t2.people_id GROUP BY t1.sex ORDER BY avg(t2.unsure_rate) DESC LIMIT 1

Question: what are the names of people who did not participate in the candidate election.
SQL: SELECT name FROM people WHERE people_id NOT IN (SELECT people_id FROM candidate)

Question: Find the names of the candidates whose support percentage is lower than their oppose rate.
SQL: SELECT t1.name FROM people AS t1 JOIN candidate AS t2 ON t1.people_id  =  t2.people_id WHERE t2.support_rate  <  t2.oppose_rate

Question: how many people are there whose weight is higher than 85 for each gender?
SQL: SELECT count(*) ,  sex FROM people WHERE weight  >  85 GROUP BY sex

Question: find the highest support percentage, lowest consider rate and oppose rate of all candidates.
SQL: SELECT max(support_rate) ,  min(consider_rate) ,  min(oppose_rate) FROM candidate

Question: list all female (sex is F) candidate names in the alphabetical order.
SQL: SELECT t1.name FROM people AS t1 JOIN candidate AS t2 ON t1.people_id  =  t2.people_id WHERE t1.sex  =  'F' ORDER BY t1.name