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

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'