minktn/spider-data huggingface dataset:
Question: Select all warehouses.

SQL:
select * from warehouses;
Question: Select all boxes with a value larger than $150.

SQL:
select * from boxes where Value>150;
Question: Select all distinct contents in all the boxes.

SQL:
select distinct contents from boxes;
Question: Select the average value of all the boxes.

SQL:
select avg(value) from boxes;
Question: Select the warehouse code and the average value of the boxes in each warehouse.

SQL:
select warehouse, avg(value) from boxes group by warehouse;
Question: Same as previous exercise, but select only those warehouses where the average value of the boxes is greater than 150.

SQL:
select warehouse, avg(value) 
from boxes 
group by warehouse
having avg(value)> 150;
Question: Select the code of each box, along with the name of the city the box is located in.

SQL:
select boxes.code, warehouses.location
from boxes join warehouses
on boxes.Warehouse = Warehouses.Code;
SELECT Boxes.Code, Location
      FROM Warehouses 
INNER JOIN Boxes ON Warehouses.Code = Boxes.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: Select the codes of all warehouses that are saturated (a warehouse is saturated if the number of boxes in it is larger than the warehouse's capacity).

SQL:
SELECT Code
   FROM Warehouses
   WHERE Capacity <
   (
     SELECT COUNT(*)
       FROM Boxes
       WHERE Warehouse = Warehouses.Code
   );
Question: Select the codes of all the boxes located in Chicago.
SQL:
select Boxes.code 
from boxes join Warehouses
on boxes.warehouse = warehouses.code
where warehouses.location = 'Chicago';
SELECT Code
FROM Boxes
   WHERE Warehouse IN
   (
     SELECT Code
       FROM Warehouses
       WHERE Location = 'Chicago'
   );