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
Find the distinct last names of all the students who have president votes and whose advisor is not 2192.
assistant
SELECT DISTINCT T1.LName FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = PRESIDENT_Vote EXCEPT SELECT DISTINCT LName FROM STUDENT WHERE Advisor = '2192'
human
What are the maximum and minimum age of students with major 600?
assistant
SELECT max(Age) , min(Age) FROM STUDENT WHERE Major = 600
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 maximum age of all the students.
assistant
SELECT max(Age) FROM STUDENT
human
Find the last names of students with major 50.
assistant
SELECT LName FROM STUDENT WHERE Major = 50
human
What are the first names of all the students aged above 22?
assistant
SELECT Fname FROM STUDENT WHERE Age > 22 ;