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
Report the distinct registration date and the election cycle.
assistant
SELECT DISTINCT Registration_Date , Election_Cycle FROM VOTING_RECORD
human
Find the distinct last names of the students who have class president votes.
assistant
SELECT DISTINCT T1.LName FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = T2.CLASS_President_VOTE
human
Find the distinct first names of all the students who have vice president votes and whose city code is not PIT.
assistant
SELECT DISTINCT T1.Fname FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = T2.VICE_PRESIDENT_Vote EXCEPT SELECT DISTINCT Fname FROM STUDENT WHERE city_code = 'PIT'
human
Find the first and last name of all the students of age 18 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
Find the distinct number of president votes.
assistant
SELECT count(DISTINCT President_Vote) FROM VOTING_RECORD
human
Report the distinct president vote and the vice president vote.
assistant
SELECT DISTINCT President_Vote , VICE_President_Vote FROM VOTING_RECORD ;