Question: Find the id of the pet owned by student whose last name is ‘Smith’.
Schema: create table has_pet (petid varchar, stuid varchar, PRIMARY KEY (petid)); create table student (stuid varchar, lname varchar, PRIMARY KEY (stuid))
SQL: select t2.petid from student as t1 join has_pet as t2 on t1.stuid = t2.stuid where t1.lname = 'smith'