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 last names of students with major 50.
assistant
SELECT LName FROM STUDENT WHERE Major = 50
human
Find the distinct ages of students who have secretary votes in the fall election cycle.
assistant
SELECT DISTINCT T1.Age FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = T2.Secretary_Vote WHERE T2.Election_Cycle = 'Fall'
human
Find the first names of students with age above 22.
assistant
SELECT Fname FROM STUDENT WHERE Age > 22
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 number of students in total.
assistant
SELECT count(*) FROM STUDENT
human
Find the maximum age of all the students.
assistant
SELECT MAX( Age ) FROM STUDENT ;