human
Schema:
Student (StuID, LName, Fname, Age, Sex, Major, Advisor, city_code)
Voting_record (StuID, Registration_Date, Election_Cycle, President_Vote, Vice_President_Vote, Secretary_Vote, Treasurer_Vote, Class_President_Vote, Class_Senator_Vote)
Please answer with SQL.
assistant
Sure, I understand.
human
What is the first and last name of all students 18 years old who have vice president votes?
assistant
SELECT DISTINCT T1.Fname , T1.LName FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = T2.VICE_President_VOTE WHERE T1.age = 18;
human
Ok, what is the first and last name of the student who has president votes?
assistant
SELECT DISTINCT T1.Fname , T1.LName FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = T2.President_Vote;
human
Ok, and of the students who had President votes how many were males?
assistant
SELECT DISTINCT COUNT( * ) FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = T2.President_VOTE WHERE T1.sex = "M" ;