target-benchmark/spider-queries huggingface dataset:
Database: department_store (tables: product_suppliers, order_items)
Question: Return the ids of all products that were ordered more than three times or supplied more than 80000.
SQL: SELECT product_id FROM Order_Items GROUP BY product_id HAVING count(*)  >  3 UNION SELECT product_id FROM Product_Suppliers GROUP BY product_id HAVING sum(total_amount_purchased)  >  80000
Database: department_store (tables: product_suppliers, order_items)
Question: What are the ids of all products that were either ordered more than 3 times or have a cumulative amount purchased of above 80000?
SQL: SELECT product_id FROM Order_Items GROUP BY product_id HAVING count(*)  >  3 UNION SELECT product_id FROM Product_Suppliers GROUP BY product_id HAVING sum(total_amount_purchased)  >  80000
Database: department_store (tables: products)
Question: What are id and name of the products whose price is lower than 600 or higher than 900?
SQL: SELECT product_id ,  product_name FROM products WHERE product_price  <  600 OR product_price  >  900
Database: department_store (tables: products)
Question: Give the ids and names of products with price lower than 600 or higher than 900.
SQL: SELECT product_id ,  product_name FROM products WHERE product_price  <  600 OR product_price  >  900
Database: department_store (tables: product_suppliers)
Question: Find the id of suppliers whose average amount purchased for each product is above 50000 or below 30000.
SQL: SELECT supplier_id FROM Product_Suppliers GROUP BY supplier_id HAVING avg(total_amount_purchased)  >  50000 OR avg(total_amount_purchased)  <  30000
Database: department_store (tables: product_suppliers)
Question: What are the ids of suppliers which have an average amount purchased of above 50000 or below 30000?
SQL: SELECT supplier_id FROM Product_Suppliers GROUP BY supplier_id HAVING avg(total_amount_purchased)  >  50000 OR avg(total_amount_purchased)  <  30000
Database: department_store (tables: product_suppliers)
Question: What are the average amount purchased and value purchased for the supplier who supplies the most products.
SQL: SELECT avg(total_amount_purchased) ,  avg(total_value_purchased) FROM Product_Suppliers WHERE supplier_id  =  (SELECT supplier_id FROM Product_Suppliers GROUP BY supplier_id ORDER BY count(*) DESC LIMIT 1)
Database: department_store (tables: product_suppliers)
Question: Return the average total amount purchased and total value purchased for the supplier who supplies the greatest number of products.
SQL: SELECT avg(total_amount_purchased) ,  avg(total_value_purchased) FROM Product_Suppliers WHERE supplier_id  =  (SELECT supplier_id FROM Product_Suppliers GROUP BY supplier_id ORDER BY count(*) DESC LIMIT 1)
Database: department_store (tables: customers)
Question: What is the largest and smallest customer codes?
SQL: SELECT max(customer_code) ,  min(customer_code) FROM Customers
Database: department_store (tables: customers)
Question: Return the maximum and minimum customer codes.
SQL: SELECT max(customer_code) ,  min(customer_code) FROM Customers
Database: department_store (tables: products, customer_orders, customers, order_items)
Question: List the names of all the distinct customers who bought a keyboard.
SQL: SELECT DISTINCT T1.customer_name FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id  =  T2.customer_id JOIN order_items AS T3 ON T2.order_id  =  T3.order_id JOIN products AS T4 ON T3.product_id  =  T4.product_id WHERE T4.product_name  =  "keyboard"
Database: department_store (tables: products, customer_orders, customers, order_items)
Question: What are the distinct names of customers who have purchased a keyboard?
SQL: SELECT DISTINCT T1.customer_name FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id  =  T2.customer_id JOIN order_items AS T3 ON T2.order_id  =  T3.order_id JOIN products AS T4 ON T3.product_id  =  T4.product_id WHERE T4.product_name  =  "keyboard"
Database: department_store (tables: products, suppliers, product_suppliers)
Question: List the names and phone numbers of all the distinct suppliers who supply red jeans.
SQL: SELECT DISTINCT T1.supplier_name ,  T1.supplier_phone FROM suppliers AS T1 JOIN product_suppliers AS T2 ON T1.supplier_id  =  T2.supplier_id JOIN products AS T3 ON T2.product_id  =  T3.product_id WHERE T3.product_name  =  "red jeans"
Database: department_store (tables: products, suppliers, product_suppliers)
Question: What are the distinct names and phone numbers for suppliers who have red jeans?
SQL: SELECT DISTINCT T1.supplier_name ,  T1.supplier_phone FROM suppliers AS T1 JOIN product_suppliers AS T2 ON T1.supplier_id  =  T2.supplier_id JOIN products AS T3 ON T2.product_id  =  T3.product_id WHERE T3.product_name  =  "red jeans"
Database: department_store (tables: products)
Question: What are the highest and lowest prices of products, grouped by and alphabetically ordered by product type?
SQL: SELECT max(product_price) ,  min(product_price) ,  product_type_code FROM products GROUP BY product_type_code ORDER BY product_type_code
Database: department_store (tables: products)
Question: Give the maximum and minimum product prices for each product type, grouped and ordered by product type.
SQL: SELECT max(product_price) ,  min(product_price) ,  product_type_code FROM products GROUP BY product_type_code ORDER BY product_type_code
Database: department_store (tables: customer_orders)
Question: List the order id, customer id for orders in Cancelled status, ordered by their order dates.
SQL: SELECT order_id ,  customer_id FROM customer_orders WHERE order_status_code  =   "Cancelled" ORDER BY order_date
Database: department_store (tables: customer_orders)
Question: What are the order ids and customer ids for orders that have been Cancelled, sorted by their order dates?
SQL: SELECT order_id ,  customer_id FROM customer_orders WHERE order_status_code  =   "Cancelled" ORDER BY order_date
Database: department_store (tables: products, customer_orders, order_items)
Question: Find the names of products that were bought by at least two distinct customers.
SQL: SELECT DISTINCT T3.product_name FROM customer_orders AS T1 JOIN order_items AS T2 ON T1.order_id  =  T2.order_id JOIN products AS T3 ON T2.product_id  =  T3.product_id GROUP BY T3.product_id HAVING COUNT (DISTINCT T1.customer_id)  >=  2
Database: department_store (tables: products, customer_orders, order_items)
Question: What are the distinct names of products purchased by at least two different customers?
SQL: SELECT DISTINCT T3.product_name FROM customer_orders AS T1 JOIN order_items AS T2 ON T1.order_id  =  T2.order_id JOIN products AS T3 ON T2.product_id  =  T3.product_id GROUP BY T3.product_id HAVING COUNT (DISTINCT T1.customer_id)  >=  2
Database: department_store (tables: customer_orders, customers, order_items)
Question: Find the names of customers who have bought by at least three distinct products.
SQL: SELECT DISTINCT T1.customer_name FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id  =  T2.customer_id JOIN order_items AS T3 ON T2.order_id  =  T3.order_id GROUP BY T1.customer_id HAVING COUNT (DISTINCT T3.product_id)  >=  3
Database: department_store (tables: customer_orders, customers, order_items)
Question: What are the distinct names of customers who have purchased at least three different products?
SQL: SELECT DISTINCT T1.customer_name FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id  =  T2.customer_id JOIN order_items AS T3 ON T2.order_id  =  T3.order_id GROUP BY T1.customer_id HAVING COUNT (DISTINCT T3.product_id)  >=  3
Database: department_store (tables: staff_department_assignments, staff)
Question: Find the name and gender of the staff who has been assigned the job of Sales Person but never Clerical Staff.
SQL: SELECT T1.staff_name ,  T1.staff_gender FROM staff AS T1 JOIN Staff_Department_Assignments AS T2 ON T1.staff_id  =  T2.staff_id WHERE T2.job_title_code  =  "Sales Person" EXCEPT SELECT T1.staff_name ,  T1.staff_gender FROM staff AS T1 JOIN Staff_Department_Assignments AS T2 ON T1.staff_id  =  T2.staff_id WHERE T2.job_title_code  =  "Clerical Staff"
Database: department_store (tables: staff_department_assignments, staff)
Question: What are the names and genders of staff who have held the title Sales Person, but never Clerical Staff?
SQL: SELECT T1.staff_name ,  T1.staff_gender FROM staff AS T1 JOIN Staff_Department_Assignments AS T2 ON T1.staff_id  =  T2.staff_id WHERE T2.job_title_code  =  "Sales Person" EXCEPT SELECT T1.staff_name ,  T1.staff_gender FROM staff AS T1 JOIN Staff_Department_Assignments AS T2 ON T1.staff_id  =  T2.staff_id WHERE T2.job_title_code  =  "Clerical Staff"
Database: department_store (tables: customers)
Question: Find the id and name of customers whose address contains WY state and do not use credit card for payment.
SQL: SELECT customer_id ,  customer_name FROM customers WHERE customer_address LIKE "%WY%" AND payment_method_code != "Credit Card"
Database: department_store (tables: customers)
Question: What are the ids and names of customers with addressed that contain WY and who do not use a credit card for payment?
SQL: SELECT customer_id ,  customer_name FROM customers WHERE customer_address LIKE "%WY%" AND payment_method_code != "Credit Card"
Database: department_store (tables: products)
Question: Find the average price of all product clothes.
SQL: SELECT avg(product_price) FROM products WHERE product_type_code  =  'Clothes'
Database: department_store (tables: products)
Question: What is the average price of clothes?
SQL: SELECT avg(product_price) FROM products WHERE product_type_code  =  'Clothes'
Database: department_store (tables: products)
Question: Find the name of the most expensive hardware product.
SQL: SELECT product_name FROM products WHERE product_type_code  =  'Hardware' ORDER BY product_price DESC LIMIT 1
Database: department_store (tables: products)
Question: What is the name of the hardware product with the greatest price?
SQL: SELECT product_name FROM products WHERE product_type_code  =  'Hardware' ORDER BY product_price DESC LIMIT 1
Database: aircraft (tables: aircraft)
Question: How many aircrafts are there?
SQL: SELECT count(*) FROM aircraft
Database: aircraft (tables: aircraft)
Question: What is the number of aircraft?
SQL: SELECT count(*) FROM aircraft
Database: aircraft (tables: aircraft)
Question: List the description of all aircrafts.
SQL: SELECT Description FROM aircraft
Database: aircraft (tables: aircraft)
Question: What are the descriptions for the aircrafts?
SQL: SELECT Description FROM aircraft
Database: aircraft (tables: airport)
Question: What is the average number of international passengers of all airports?
SQL: SELECT avg(International_Passengers) FROM airport
Database: aircraft (tables: airport)
Question: What is the average number of international passengers for an airport?
SQL: SELECT avg(International_Passengers) FROM airport
Database: aircraft (tables: airport)
Question: What are the number of international and domestic passengers of the airport named London "Heathrow"?
SQL: SELECT International_Passengers ,  Domestic_Passengers FROM airport WHERE Airport_Name  =  "London Heathrow"
Database: aircraft (tables: airport)
Question: How many international and domestic passengers are there in the airport London Heathrow?
SQL: SELECT International_Passengers ,  Domestic_Passengers FROM airport WHERE Airport_Name  =  "London Heathrow"
Database: aircraft (tables: airport)
Question: What are the total number of Domestic Passengers of airports that contain the word "London".
SQL: SELECT sum(Domestic_Passengers) FROM airport WHERE Airport_Name LIKE "%London%"
Database: aircraft (tables: airport)
Question: What are the total number of domestic passengers at all London airports?
SQL: SELECT sum(Domestic_Passengers) FROM airport WHERE Airport_Name LIKE "%London%"
Database: aircraft (tables: airport)
Question: What are the maximum and minimum number of transit passengers of all aiports.
SQL: SELECT max(Transit_Passengers) ,  min(Transit_Passengers) FROM airport
Database: aircraft (tables: airport)
Question: What is the maximum and mininum number of transit passengers for all airports?
SQL: SELECT max(Transit_Passengers) ,  min(Transit_Passengers) FROM airport
Database: aircraft (tables: pilot)
Question: What are the name of pilots aged 25 or older?
SQL: SELECT Name FROM pilot WHERE Age  >=  25
Database: aircraft (tables: pilot)
Question: what is the name of every pilot who is at least 25 years old?
SQL: SELECT Name FROM pilot WHERE Age  >=  25
Database: aircraft (tables: pilot)
Question: List all pilot names in ascending alphabetical order.
SQL: SELECT Name FROM pilot ORDER BY Name ASC
Database: aircraft (tables: pilot)
Question: What are the names of the pilots in alphabetical order?
SQL: SELECT Name FROM pilot ORDER BY Name ASC
Database: aircraft (tables: pilot)
Question: List names of all pilot aged 30 or younger in descending alphabetical order.
SQL: SELECT Name FROM pilot WHERE Age  <=  30 ORDER BY Name DESC
Database: aircraft (tables: pilot)
Question: What are the names of all pilots 30 years old or young in descending alphabetical order?
SQL: SELECT Name FROM pilot WHERE Age  <=  30 ORDER BY Name DESC
Database: aircraft (tables: aircraft, airport_aircraft, airport)
Question: Please show the names of aircrafts associated with airport with name "London Gatwick".
SQL: SELECT T1.Aircraft FROM aircraft AS T1 JOIN airport_aircraft AS T2 ON T1.Aircraft_ID  =  T2.Aircraft_ID JOIN airport AS T3 ON T2.Airport_ID  =  T3.Airport_ID WHERE T3.Airport_Name  =  "London Gatwick"
Database: aircraft (tables: aircraft, airport_aircraft, airport)
Question: What are the names of all the aircrafts associated with London Gatwick airport?
SQL: SELECT T1.Aircraft FROM aircraft AS T1 JOIN airport_aircraft AS T2 ON T1.Aircraft_ID  =  T2.Aircraft_ID JOIN airport AS T3 ON T2.Airport_ID  =  T3.Airport_ID WHERE T3.Airport_Name  =  "London Gatwick"
Database: aircraft (tables: aircraft, airport_aircraft, airport)
Question: Please show the names and descriptions of aircrafts associated with airports that have a total number of passengers bigger than 10000000.
SQL: SELECT T1.Aircraft ,  T1.Description FROM aircraft AS T1 JOIN airport_aircraft AS T2 ON T1.Aircraft_ID  =  T2.Aircraft_ID JOIN airport AS T3 ON T2.Airport_ID  =  T3.Airport_ID WHERE T3.Total_Passengers  >  10000000
Database: aircraft (tables: aircraft, airport_aircraft, airport)
Question: What are the names and descriptions of aircrafts associated with an airport that has more total passengers than 10000000?
SQL: SELECT T1.Aircraft ,  T1.Description FROM aircraft AS T1 JOIN airport_aircraft AS T2 ON T1.Aircraft_ID  =  T2.Aircraft_ID JOIN airport AS T3 ON T2.Airport_ID  =  T3.Airport_ID WHERE T3.Total_Passengers  >  10000000
Database: aircraft (tables: aircraft, airport_aircraft, airport)
Question: What is the average total number of passengers of airports that are associated with aircraft "Robinson R-22"?
SQL: SELECT avg(T3.Total_Passengers) FROM aircraft AS T1 JOIN airport_aircraft AS T2 ON T1.Aircraft_ID  =  T2.Aircraft_ID JOIN airport AS T3 ON T2.Airport_ID  =  T3.Airport_ID WHERE T1.Aircraft  =  "Robinson R-22"
Database: aircraft (tables: aircraft, airport_aircraft, airport)
Question: What is the average total number of passengers for all airports that the aircraft "Robinson R-22" visits?
SQL: SELECT avg(T3.Total_Passengers) FROM aircraft AS T1 JOIN airport_aircraft AS T2 ON T1.Aircraft_ID  =  T2.Aircraft_ID JOIN airport AS T3 ON T2.Airport_ID  =  T3.Airport_ID WHERE T1.Aircraft  =  "Robinson R-22"
Database: aircraft (tables: aircraft, match)
Question: Please list the location and the winning aircraft name.
SQL: SELECT T2.Location ,  T1.Aircraft FROM aircraft AS T1 JOIN MATCH AS T2 ON T1.Aircraft_ID  =  T2.Winning_Aircraft
Database: aircraft (tables: aircraft, match)
Question: What is the location and name of the winning aircraft?
SQL: SELECT T2.Location ,  T1.Aircraft FROM aircraft AS T1 JOIN MATCH AS T2 ON T1.Aircraft_ID  =  T2.Winning_Aircraft
Database: aircraft (tables: aircraft, match)
Question: List the name of the aircraft that has been named winning aircraft the most number of times.
SQL: SELECT T1.Aircraft FROM aircraft AS T1 JOIN MATCH AS T2 ON T1.Aircraft_ID  =  T2.Winning_Aircraft GROUP BY T2.Winning_Aircraft ORDER BY COUNT(*) DESC LIMIT 1
Database: aircraft (tables: aircraft, match)
Question: What is the name of the aircraft that has won an award the most?
SQL: SELECT T1.Aircraft FROM aircraft AS T1 JOIN MATCH AS T2 ON T1.Aircraft_ID  =  T2.Winning_Aircraft GROUP BY T2.Winning_Aircraft ORDER BY COUNT(*) DESC LIMIT 1
Database: aircraft (tables: aircraft, match)
Question: List the names of aircrafts and the number of times it won matches.
SQL: SELECT T1.Aircraft ,  COUNT(*) FROM aircraft AS T1 JOIN MATCH AS T2 ON T1.Aircraft_ID  =  T2.Winning_Aircraft GROUP BY T2.Winning_Aircraft
Database: aircraft (tables: aircraft, match)
Question: For each aircraft that has won an award, what is its name and how many time has it won?
SQL: SELECT T1.Aircraft ,  COUNT(*) FROM aircraft AS T1 JOIN MATCH AS T2 ON T1.Aircraft_ID  =  T2.Winning_Aircraft GROUP BY T2.Winning_Aircraft
Database: aircraft (tables: pilot)
Question: List names of all pilot in descending order of age.
SQL: SELECT Name FROM pilot ORDER BY Age DESC
Database: aircraft (tables: pilot)
Question: What are the names of all pilots listed by descending age?
SQL: SELECT Name FROM pilot ORDER BY Age DESC
Database: aircraft (tables: aircraft, match)
Question: List the names of aircrafts and that won matches at least twice.
SQL: SELECT T1.Aircraft FROM aircraft AS T1 JOIN MATCH AS T2 ON T1.Aircraft_ID  =  T2.Winning_Aircraft GROUP BY T2.Winning_Aircraft HAVING COUNT(*)  >=  2
Database: aircraft (tables: aircraft, match)
Question: What are the names of all aircrafts that have won a match at least twice?
SQL: SELECT T1.Aircraft FROM aircraft AS T1 JOIN MATCH AS T2 ON T1.Aircraft_ID  =  T2.Winning_Aircraft GROUP BY T2.Winning_Aircraft HAVING COUNT(*)  >=  2
Database: aircraft (tables: aircraft, match)
Question: List the names of aircrafts and that did not win any match.
SQL: SELECT Aircraft FROM aircraft WHERE Aircraft_ID NOT IN (SELECT Winning_Aircraft FROM MATCH)
Database: aircraft (tables: aircraft, match)
Question: What are the names of all aicrafts that have never won any match?
SQL: SELECT Aircraft FROM aircraft WHERE Aircraft_ID NOT IN (SELECT Winning_Aircraft FROM MATCH)
Database: aircraft (tables: aircraft, airport_aircraft, airport)
Question: Show the names of aircrafts that are associated with both an airport named "London Heathrow" and an airport named "London Gatwick"
SQL: SELECT T1.Aircraft FROM aircraft AS T1 JOIN airport_aircraft AS T2 ON T1.Aircraft_ID  =  T2.Aircraft_ID JOIN airport AS T3 ON T2.Airport_ID  =  T3.Airport_ID WHERE T3.Airport_Name  =  "London Heathrow" INTERSECT SELECT T1.Aircraft FROM aircraft AS T1 JOIN airport_aircraft AS T2 ON T1.Aircraft_ID  =  T2.Aircraft_ID JOIN airport AS T3 ON T2.Airport_ID  =  T3.Airport_ID WHERE T3.Airport_Name  =  "London Gatwick"
Database: aircraft (tables: aircraft, airport_aircraft, airport)
Question: What are the names of all aircrafts that are associated with both London Heathrow and Gatwick airports?
SQL: SELECT T1.Aircraft FROM aircraft AS T1 JOIN airport_aircraft AS T2 ON T1.Aircraft_ID  =  T2.Aircraft_ID JOIN airport AS T3 ON T2.Airport_ID  =  T3.Airport_ID WHERE T3.Airport_Name  =  "London Heathrow" INTERSECT SELECT T1.Aircraft FROM aircraft AS T1 JOIN airport_aircraft AS T2 ON T1.Aircraft_ID  =  T2.Aircraft_ID JOIN airport AS T3 ON T2.Airport_ID  =  T3.Airport_ID WHERE T3.Airport_Name  =  "London Gatwick"
Database: aircraft (tables: airport)
Question: Show all information on the airport that has the largest number of international passengers.
SQL: SELECT * FROM airport ORDER BY International_Passengers DESC LIMIT 1
Database: aircraft (tables: airport)
Question: What is all the information on the airport with the largest number of international passengers?
SQL: SELECT * FROM airport ORDER BY International_Passengers DESC LIMIT 1
Database: aircraft (tables: match, pilot)
Question: find the name and age of the pilot who has won the most number of times among the pilots who are younger than 30.
SQL: SELECT t1.name ,  t1.age FROM pilot AS t1 JOIN MATCH AS t2 ON t1.pilot_id  =  t2.winning_pilot WHERE t1.age  <  30 GROUP BY t2.winning_pilot ORDER BY count(*) DESC LIMIT 1
Database: aircraft (tables: match, pilot)
Question: What is the name and age of the pilot younger than 30 who has won the most number of times?
SQL: SELECT t1.name ,  t1.age FROM pilot AS t1 JOIN MATCH AS t2 ON t1.pilot_id  =  t2.winning_pilot WHERE t1.age  <  30 GROUP BY t2.winning_pilot ORDER BY count(*) DESC LIMIT 1
Database: aircraft (tables: match, pilot)
Question: what is the name and age of the youngest winning pilot?
SQL: SELECT t1.name ,  t1.age FROM pilot AS t1 JOIN MATCH AS t2 ON t1.pilot_id  =  t2.winning_pilot ORDER BY t1.age LIMIT 1
Database: aircraft (tables: match, pilot)
Question: How old is the youngest winning pilot and what is their name?
SQL: SELECT t1.name ,  t1.age FROM pilot AS t1 JOIN MATCH AS t2 ON t1.pilot_id  =  t2.winning_pilot ORDER BY t1.age LIMIT 1
Database: aircraft (tables: match, pilot)
Question: find the name of pilots who did not win the matches held in the country of Australia.
SQL: SELECT name FROM pilot WHERE pilot_id NOT IN (SELECT Winning_Pilot  FROM MATCH WHERE country  =  'Australia')
Database: aircraft (tables: match, pilot)
Question: What are the names of the pilots that have not won any matches in Australia?
SQL: SELECT name FROM pilot WHERE pilot_id NOT IN (SELECT Winning_Pilot  FROM MATCH WHERE country  =  'Australia')
Database: local_govt_and_lot (tables: properties, residents)
Question: How many residents does each property have? List property id and resident count.
SQL: SELECT T1.property_id ,  count(*) FROM properties AS T1 JOIN residents AS T2 ON T1.property_id  =  T2.property_id GROUP BY T1.property_id
Database: local_govt_and_lot (tables: organizations, services)
Question: What is the distinct service types that are provided by the organization which has detail 'Denesik and Sons Party'?
SQL: SELECT DISTINCT T1.service_type_code FROM services AS T1 JOIN organizations AS T2 ON T1.organization_id  =  T2.organization_id WHERE T2.organization_details  =  'Denesik and Sons Party'
Database: local_govt_and_lot (tables: residents, residents_services)
Question: How many services has each resident requested? List the resident id, details, and the count in descending order of the count.
SQL: SELECT T1.resident_id ,  T1.other_details ,  count(*) FROM Residents AS T1 JOIN Residents_Services AS T2 ON T1.resident_id  =  T2.resident_id GROUP BY T1.resident_id ORDER BY count(*) DESC
Database: local_govt_and_lot (tables: residents_services, services)
Question: What is the maximum number that a certain service is provided? List the service id, details and number.
SQL: SELECT T1.service_id ,  T1.service_details ,  count(*) FROM Services AS T1 JOIN Residents_Services AS T2 ON T1.service_id  =  T2.service_id GROUP BY T1.service_id ORDER BY count(*) DESC LIMIT 1
Database: local_govt_and_lot (tables: organizations, things)
Question: List the id and type of each thing, and the details of the organization that owns it.
SQL: SELECT T1.thing_id ,  T1.type_of_Thing_Code ,  T2.organization_details FROM Things AS T1 JOIN Organizations AS T2 ON T1.organization_id  =  T2.organization_id
Database: local_govt_and_lot (tables: customer_events, customers)
Question: What are the id and details of the customers who have at least 3 events?
SQL: SELECT T1.customer_id ,  T1.customer_details FROM Customers AS T1 JOIN Customer_Events AS T2 ON T1.customer_id  =  T2.customer_id GROUP BY T1.customer_id HAVING count(*)  >=  3
Database: local_govt_and_lot (tables: customer_events, customers)
Question: What is each customer's move in date, and the corresponding customer id and details?
SQL: SELECT T2.date_moved_in ,  T1.customer_id ,  T1.customer_details FROM Customers AS T1 JOIN Customer_Events AS T2 ON T1.customer_id  =  T2.customer_id