Context: CREATE TABLE has_pet (petid VARCHAR, stuid VARCHAR); CREATE TABLE student (stuid VARCHAR, Lname VARCHAR)
Question: Find the id of the pet owned by student whose last name is ‘Smith’.
Answer: SELECT T2.petid FROM student AS T1 JOIN has_pet AS T2 ON T1.stuid = T2.stuid WHERE T1.Lname = 'Smith'