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

How many restaurant is the Sandwich type restaurant?
SELECT COUNT(*) FROM restaurant JOIN type_of_restaurant ON restaurant.resid = type_of_restaurant.resid JOIN restaurant_type ON type_of_restaurant.restypeid = restaurant_type.restypeid GROUP BY type_of_restaurant.restypeid HAVING restaurant_type.restypename = 'Sandwich'
SELECT COUNT(*) FROM "restaurant" JOIN "type_of_restaurant" ON "restaurant"."resid" = "type_of_restaurant"."resid" JOIN "restaurant_type" ON "restaurant_type"."restypeid" = "type_of_restaurant"."restypeid" GROUP BY "type_of_restaurant"."restypeid" HAVING "restaurant_type"."restypename" = 'Sandwich'