CREATE TABLE visits_restaurant (stuid NUMBER, resid NUMBER, time TIME, spent NUMBER)
CREATE TABLE student (stuid NUMBER, lname CLOB, fname CLOB, age NUMBER, sex CLOB, major NUMBER, advisor NUMBER, city_code CLOB)
CREATE TABLE type_of_restaurant (resid NUMBER, restypeid NUMBER)
CREATE TABLE restaurant_type (restypeid NUMBER, restypename CLOB, restypedescription CLOB)
CREATE TABLE restaurant (resid NUMBER, resname CLOB, address CLOB, rating NUMBER)

When did Linda Smith visit Subway?
SELECT time FROM student JOIN visits_restaurant ON student.stuid = visits_restaurant.stuid JOIN restaurant ON visits_restaurant.resid = restaurant.resid WHERE student.fname = "Linda" AND student.lname = "Smith" AND restaurant.resname = "Subway"
SELECT "time" FROM "student" JOIN "visits_restaurant" ON "student"."stuid" = "visits_restaurant"."stuid" JOIN "restaurant" ON "Subway" = "restaurant"."resname" AND "restaurant"."resid" = "visits_restaurant"."resid" WHERE "Linda" = "student"."fname" AND "Smith" = "student"."lname"