Database schema:
CREATE TABLE Warehouses (
  Code NUMBER PRIMARY KEY,
  Location TEXT,
  Capacity NUMBER
);
CREATE TABLE Boxes (
  Code TEXT PRIMARY KEY,
  Contents TEXT,
  Value NUMBER,
  Warehouse NUMBER,
  FOREIGN KEY (Warehouse) REFERENCES Warehouses(Code)
);

Question: What are all the different contents stored in boxes in New York?
SQL: SELECT DISTINCT T1.contents FROM boxes AS T1 JOIN warehouses AS T2 ON T1.warehouse  =  T2.code WHERE LOCATION  =  'New York'

Question: What are the locations of warehouses in which boxes that contain Rocks and Scissors are kept?
SQL: SELECT T2.location FROM boxes AS T1 JOIN warehouses AS T2 ON T1.warehouse  =  T2.code WHERE T1.contents  =  'Rocks' INTERSECT SELECT T2.location FROM boxes AS T1 JOIN warehouses AS T2 ON T1.warehouse  =  T2.code WHERE T1.contents  =  'Scissors'

Question: Find the code and content of all boxes whose value is higher than the value of all boxes with Scissors as content.
SQL: SELECT code ,  CONTENTS FROM boxes WHERE value  >  (SELECT max(value) FROM boxes WHERE CONTENTS  =  'Scissors')

Question: List the code and contents of all boxes sorted by their values.
SQL: SELECT code ,  CONTENTS FROM boxes ORDER BY value

Question: Find all distinct locations of warehouses.
SQL: SELECT count(DISTINCT LOCATION) FROM warehouses

Question: Find the total value and number of boxes for each content type.
SQL: SELECT sum(value) ,  count(*) ,  CONTENTS FROM boxes GROUP BY CONTENTS

Question: Select the code of each box, along with the name of the city the box is located in.
SQL: SELECT T1.code ,  T2.location FROM boxes AS T1 JOIN warehouses AS T2 ON T1.Warehouse  =  T2.Code

Question: Select contents of all boxes with a value larger than $150.
SQL: SELECT CONTENTS FROM boxes WHERE Value  >  150

Question: How many boxes are stored in each warehouse?
SQL: SELECT count(*) ,  warehouse FROM boxes GROUP BY warehouse

Question: For each location, what are the total, average, and maximum capacities of warehouses?
SQL: SELECT sum(capacity) ,  avg(capacity) ,  max(capacity) ,  LOCATION FROM warehouses GROUP BY LOCATION

Question: Find the average and maximum value for each different content.
SQL: SELECT avg(value) ,  max(value) ,  CONTENTS FROM boxes GROUP BY CONTENTS

Question: Select all distinct contents in all the boxes.
SQL: SELECT DISTINCT CONTENTS FROM boxes

Question: Find the number of boxes saved in each warehouse.
SQL: SELECT count(*) ,  warehouse FROM boxes GROUP BY warehouse

Question: Select the warehouse codes along with the number of boxes in each warehouse.
SQL: SELECT Warehouse ,  count(*) FROM boxes GROUP BY warehouse

Question: What is the total value of boxes kept in the warehouse with the greatest capacity?
SQL: SELECT sum(T1.value) FROM boxes AS T1 JOIN warehouses AS T2 ON T1.warehouse  =  T2.code ORDER BY T2.capacity DESC LIMIT 1

Question: Find the total value of boxes in the warehouses located at Chicago or New York.
SQL: SELECT sum(T1.value) FROM boxes AS T1 JOIN warehouses AS T2 ON T1.warehouse  =  T2.code WHERE T2.location  =  'Chicago' OR T2.location  =  'New York'

Question: What is the content with the greatest value across all boxes?
SQL: SELECT CONTENTS FROM boxes ORDER BY value DESC LIMIT 1

Question: How many different types of contents are stored in each warehouse?
SQL: SELECT count(DISTINCT CONTENTS) ,  warehouse FROM boxes GROUP BY warehouse