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 8741
assistant
SELECT DISTINCT T1.LName FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = PRESIDENT_Vote INTERSECT SELECT DISTINCT LName FROM STUDENT WHERE Advisor = '8741';
human
Give me the name for the student 1001 | Do you want the last name or first name? | first name and the last name please
assistant
SELECT lname , fname FROM student WHERE stuID = '1001';
human
can you give me the students with president vote 1004 | What attributes of that student do you want? | first and last names please
assistant
SELECT T1.LNAME , T1.FNAME FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = T2.StuID WHERE T2.PRESIDENT_VOTE = '1004';
human
Can you give me the first and last names for students with Vice President vote 1017
assistant
SELECT T1.LNAME , T1.FNAME FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = T2.StuID WHERE T2.Vice_President_Vote = '1007';
human
Give me the age for Linda Smith
assistant
SELECT age FROM STUDENT WHERE lname = "Smith" AND fname = "Linda" ;