db_name
stringclasses 146
values | prompt
stringlengths 310
4.81k
|
|---|---|
manufactory_1
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Manufacturers ( Code, Name, Headquarter, Founder, Revenue )
# Products ( Code, Name, Price, Manufacturer )
#
# Products.Manufacturer can be joined with Manufacturers.Code
#
### Question:
#
# Find the name of companies whose revenue is greater than the average revenue of all companies.
#
### SQL:
#
# SELECT name FROM manufacturers WHERE revenue > (SELECT avg(revenue) FROM manufacturers)
#
### End.
|
manufactory_1
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Manufacturers ( Code, Name, Headquarter, Founder, Revenue )
# Products ( Code, Name, Price, Manufacturer )
#
# Products.Manufacturer can be joined with Manufacturers.Code
#
### Question:
#
# What are the names of manufacturers with revenue greater than the average of all revenues?
#
### SQL:
#
# SELECT name FROM manufacturers WHERE revenue > (SELECT avg(revenue) FROM manufacturers)
#
### End.
|
manufactory_1
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Manufacturers ( Code, Name, Headquarter, Founder, Revenue )
# Products ( Code, Name, Price, Manufacturer )
#
# Products.Manufacturer can be joined with Manufacturers.Code
#
### Question:
#
# Find the name of companies whose revenue is smaller than the revenue of all companies based in Austin.
#
### SQL:
#
# SELECT name FROM manufacturers WHERE revenue < (SELECT min(revenue) FROM manufacturers WHERE headquarter = 'Austin')
#
### End.
|
manufactory_1
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Manufacturers ( Code, Name, Headquarter, Founder, Revenue )
# Products ( Code, Name, Price, Manufacturer )
#
# Products.Manufacturer can be joined with Manufacturers.Code
#
### Question:
#
# What are the names of companies with revenue less than the lowest revenue of any manufacturer in Austin?
#
### SQL:
#
# SELECT name FROM manufacturers WHERE revenue < (SELECT min(revenue) FROM manufacturers WHERE headquarter = 'Austin')
#
### End.
|
manufactory_1
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Manufacturers ( Code, Name, Headquarter, Founder, Revenue )
# Products ( Code, Name, Price, Manufacturer )
#
# Products.Manufacturer can be joined with Manufacturers.Code
#
### Question:
#
# Find the total revenue of companies whose revenue is larger than the revenue of some companies based in Austin.
#
### SQL:
#
# SELECT sum(revenue) FROM manufacturers WHERE revenue > (SELECT min(revenue) FROM manufacturers WHERE headquarter = 'Austin')
#
### End.
|
manufactory_1
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Manufacturers ( Code, Name, Headquarter, Founder, Revenue )
# Products ( Code, Name, Price, Manufacturer )
#
# Products.Manufacturer can be joined with Manufacturers.Code
#
### Question:
#
# What is the total revenue of companies with revenue greater than the lowest revenue of any manufacturer in Austin?
#
### SQL:
#
# SELECT sum(revenue) FROM manufacturers WHERE revenue > (SELECT min(revenue) FROM manufacturers WHERE headquarter = 'Austin')
#
### End.
|
manufactory_1
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Manufacturers ( Code, Name, Headquarter, Founder, Revenue )
# Products ( Code, Name, Price, Manufacturer )
#
# Products.Manufacturer can be joined with Manufacturers.Code
#
### Question:
#
# Find the total revenue of companies of each founder.
#
### SQL:
#
# SELECT sum(revenue) , founder FROM manufacturers GROUP BY founder
#
### End.
|
manufactory_1
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Manufacturers ( Code, Name, Headquarter, Founder, Revenue )
# Products ( Code, Name, Price, Manufacturer )
#
# Products.Manufacturer can be joined with Manufacturers.Code
#
### Question:
#
# What is the total revenue of companies started by founder?
#
### SQL:
#
# SELECT sum(revenue) , founder FROM manufacturers GROUP BY founder
#
### End.
|
manufactory_1
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Manufacturers ( Code, Name, Headquarter, Founder, Revenue )
# Products ( Code, Name, Price, Manufacturer )
#
# Products.Manufacturer can be joined with Manufacturers.Code
#
### Question:
#
# Find the name and revenue of the company that earns the highest revenue in each city.
#
### SQL:
#
# SELECT name , max(revenue) , Headquarter FROM manufacturers GROUP BY Headquarter
#
### End.
|
manufactory_1
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Manufacturers ( Code, Name, Headquarter, Founder, Revenue )
# Products ( Code, Name, Price, Manufacturer )
#
# Products.Manufacturer can be joined with Manufacturers.Code
#
### Question:
#
# What are the names and revenues of the companies with the highest revenues in each headquarter city?
#
### SQL:
#
# SELECT name , max(revenue) , Headquarter FROM manufacturers GROUP BY Headquarter
#
### End.
|
manufactory_1
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Manufacturers ( Code, Name, Headquarter, Founder, Revenue )
# Products ( Code, Name, Price, Manufacturer )
#
# Products.Manufacturer can be joined with Manufacturers.Code
#
### Question:
#
# Find the total revenue for each manufacturer.
#
### SQL:
#
# SELECT sum(revenue) , name FROM manufacturers GROUP BY name
#
### End.
|
manufactory_1
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Manufacturers ( Code, Name, Headquarter, Founder, Revenue )
# Products ( Code, Name, Price, Manufacturer )
#
# Products.Manufacturer can be joined with Manufacturers.Code
#
### Question:
#
# What is the total revenue of each manufacturer?
#
### SQL:
#
# SELECT sum(revenue) , name FROM manufacturers GROUP BY name
#
### End.
|
manufactory_1
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Manufacturers ( Code, Name, Headquarter, Founder, Revenue )
# Products ( Code, Name, Price, Manufacturer )
#
# Products.Manufacturer can be joined with Manufacturers.Code
#
### Question:
#
# Find the average prices of all products from each manufacture, and list each company's name.
#
### SQL:
#
# SELECT avg(T1.price) , T2.name FROM products AS T1 JOIN manufacturers AS T2 ON T1.Manufacturer = T2.code GROUP BY T2.name
#
### End.
|
manufactory_1
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Manufacturers ( Code, Name, Headquarter, Founder, Revenue )
# Products ( Code, Name, Price, Manufacturer )
#
# Products.Manufacturer can be joined with Manufacturers.Code
#
### Question:
#
# What are the average prices of products for each manufacturer?
#
### SQL:
#
# SELECT avg(T1.price) , T2.name FROM products AS T1 JOIN manufacturers AS T2 ON T1.Manufacturer = T2.code GROUP BY T2.name
#
### End.
|
manufactory_1
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Manufacturers ( Code, Name, Headquarter, Founder, Revenue )
# Products ( Code, Name, Price, Manufacturer )
#
# Products.Manufacturer can be joined with Manufacturers.Code
#
### Question:
#
# Find the number of different products that are produced by companies at different headquarter cities.
#
### SQL:
#
# SELECT count(DISTINCT T1.name) , T2.Headquarter FROM products AS T1 JOIN manufacturers AS T2 ON T1.Manufacturer = T2.code GROUP BY T2.Headquarter
#
### End.
|
manufactory_1
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Manufacturers ( Code, Name, Headquarter, Founder, Revenue )
# Products ( Code, Name, Price, Manufacturer )
#
# Products.Manufacturer can be joined with Manufacturers.Code
#
### Question:
#
# How many different products are produced in each headquarter city?
#
### SQL:
#
# SELECT count(DISTINCT T1.name) , T2.Headquarter FROM products AS T1 JOIN manufacturers AS T2 ON T1.Manufacturer = T2.code GROUP BY T2.Headquarter
#
### End.
|
manufactory_1
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Manufacturers ( Code, Name, Headquarter, Founder, Revenue )
# Products ( Code, Name, Price, Manufacturer )
#
# Products.Manufacturer can be joined with Manufacturers.Code
#
### Question:
#
# Find number of products which Sony does not make.
#
### SQL:
#
# SELECT count(DISTINCT name) FROM products WHERE name NOT IN (SELECT T1.name FROM products AS T1 JOIN manufacturers AS T2 ON T1.Manufacturer = T2.code WHERE T2.name = 'Sony')
#
### End.
|
manufactory_1
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Manufacturers ( Code, Name, Headquarter, Founder, Revenue )
# Products ( Code, Name, Price, Manufacturer )
#
# Products.Manufacturer can be joined with Manufacturers.Code
#
### Question:
#
# How many products are not made by Sony?
#
### SQL:
#
# SELECT count(DISTINCT name) FROM products WHERE name NOT IN (SELECT T1.name FROM products AS T1 JOIN manufacturers AS T2 ON T1.Manufacturer = T2.code WHERE T2.name = 'Sony')
#
### End.
|
manufactory_1
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Manufacturers ( Code, Name, Headquarter, Founder, Revenue )
# Products ( Code, Name, Price, Manufacturer )
#
# Products.Manufacturer can be joined with Manufacturers.Code
#
### Question:
#
# Find the name of companies that do not make DVD drive.
#
### SQL:
#
# SELECT name FROM manufacturers EXCEPT SELECT T2.name FROM products AS T1 JOIN manufacturers AS T2 ON T1.Manufacturer = T2.code WHERE T1.name = 'DVD drive'
#
### End.
|
manufactory_1
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Manufacturers ( Code, Name, Headquarter, Founder, Revenue )
# Products ( Code, Name, Price, Manufacturer )
#
# Products.Manufacturer can be joined with Manufacturers.Code
#
### Question:
#
# What are the names of companies that do not make DVD drives?
#
### SQL:
#
# SELECT name FROM manufacturers EXCEPT SELECT T2.name FROM products AS T1 JOIN manufacturers AS T2 ON T1.Manufacturer = T2.code WHERE T1.name = 'DVD drive'
#
### End.
|
manufactory_1
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Manufacturers ( Code, Name, Headquarter, Founder, Revenue )
# Products ( Code, Name, Price, Manufacturer )
#
# Products.Manufacturer can be joined with Manufacturers.Code
#
### Question:
#
# Find the number of products for each manufacturer, showing the name of each company.
#
### SQL:
#
# SELECT count(*) , T2.name FROM products AS T1 JOIN manufacturers AS T2 ON T1.Manufacturer = T2.code GROUP BY T2.name
#
### End.
|
manufactory_1
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Manufacturers ( Code, Name, Headquarter, Founder, Revenue )
# Products ( Code, Name, Price, Manufacturer )
#
# Products.Manufacturer can be joined with Manufacturers.Code
#
### Question:
#
# How many products are there for each manufacturer?
#
### SQL:
#
# SELECT count(*) , T2.name FROM products AS T1 JOIN manufacturers AS T2 ON T1.Manufacturer = T2.code GROUP BY T2.name
#
### End.
|
manufactory_1
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Manufacturers ( Code, Name, Headquarter, Founder, Revenue )
# Products ( Code, Name, Price, Manufacturer )
#
# Products.Manufacturer can be joined with Manufacturers.Code
#
### Question:
#
# Select the names of all the products in the store.
#
### SQL:
#
# SELECT Name FROM Products
#
### End.
|
manufactory_1
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Manufacturers ( Code, Name, Headquarter, Founder, Revenue )
# Products ( Code, Name, Price, Manufacturer )
#
# Products.Manufacturer can be joined with Manufacturers.Code
#
### Question:
#
# What are the names of all products?
#
### SQL:
#
# SELECT Name FROM Products
#
### End.
|
manufactory_1
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Manufacturers ( Code, Name, Headquarter, Founder, Revenue )
# Products ( Code, Name, Price, Manufacturer )
#
# Products.Manufacturer can be joined with Manufacturers.Code
#
### Question:
#
# Select the names and the prices of all the products in the store.
#
### SQL:
#
# SELECT name , price FROM products
#
### End.
|
manufactory_1
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Manufacturers ( Code, Name, Headquarter, Founder, Revenue )
# Products ( Code, Name, Price, Manufacturer )
#
# Products.Manufacturer can be joined with Manufacturers.Code
#
### Question:
#
# What are the names and prices of all products in the store?
#
### SQL:
#
# SELECT name , price FROM products
#
### End.
|
manufactory_1
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Manufacturers ( Code, Name, Headquarter, Founder, Revenue )
# Products ( Code, Name, Price, Manufacturer )
#
# Products.Manufacturer can be joined with Manufacturers.Code
#
### Question:
#
# Select the name of the products with a price less than or equal to $200.
#
### SQL:
#
# SELECT name FROM products WHERE price <= 200
#
### End.
|
manufactory_1
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Manufacturers ( Code, Name, Headquarter, Founder, Revenue )
# Products ( Code, Name, Price, Manufacturer )
#
# Products.Manufacturer can be joined with Manufacturers.Code
#
### Question:
#
# What are the names of products with price at most 200?
#
### SQL:
#
# SELECT name FROM products WHERE price <= 200
#
### End.
|
manufactory_1
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Manufacturers ( Code, Name, Headquarter, Founder, Revenue )
# Products ( Code, Name, Price, Manufacturer )
#
# Products.Manufacturer can be joined with Manufacturers.Code
#
### Question:
#
# Find all information of all the products with a price between $60 and $120.
#
### SQL:
#
# SELECT * FROM products WHERE price BETWEEN 60 AND 120
#
### End.
|
manufactory_1
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Manufacturers ( Code, Name, Headquarter, Founder, Revenue )
# Products ( Code, Name, Price, Manufacturer )
#
# Products.Manufacturer can be joined with Manufacturers.Code
#
### Question:
#
# What is all the information of all the products that have a price between 60 and 120?
#
### SQL:
#
# SELECT * FROM products WHERE price BETWEEN 60 AND 120
#
### End.
|
manufactory_1
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Manufacturers ( Code, Name, Headquarter, Founder, Revenue )
# Products ( Code, Name, Price, Manufacturer )
#
# Products.Manufacturer can be joined with Manufacturers.Code
#
### Question:
#
# Compute the average price of all the products.
#
### SQL:
#
# SELECT avg(price) FROM products
#
### End.
|
manufactory_1
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Manufacturers ( Code, Name, Headquarter, Founder, Revenue )
# Products ( Code, Name, Price, Manufacturer )
#
# Products.Manufacturer can be joined with Manufacturers.Code
#
### Question:
#
# What is the average price across all products?
#
### SQL:
#
# SELECT avg(price) FROM products
#
### End.
|
manufactory_1
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Manufacturers ( Code, Name, Headquarter, Founder, Revenue )
# Products ( Code, Name, Price, Manufacturer )
#
# Products.Manufacturer can be joined with Manufacturers.Code
#
### Question:
#
# Compute the average price of all products with manufacturer code equal to 2.
#
### SQL:
#
# SELECT avg(price) FROM products WHERE Manufacturer = 2
#
### End.
|
manufactory_1
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Manufacturers ( Code, Name, Headquarter, Founder, Revenue )
# Products ( Code, Name, Price, Manufacturer )
#
# Products.Manufacturer can be joined with Manufacturers.Code
#
### Question:
#
# What is the average price of products with manufacturer codes equal to 2?
#
### SQL:
#
# SELECT avg(price) FROM products WHERE Manufacturer = 2
#
### End.
|
manufactory_1
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Manufacturers ( Code, Name, Headquarter, Founder, Revenue )
# Products ( Code, Name, Price, Manufacturer )
#
# Products.Manufacturer can be joined with Manufacturers.Code
#
### Question:
#
# Compute the number of products with a price larger than or equal to $180.
#
### SQL:
#
# SELECT count(*) FROM products WHERE price >= 180
#
### End.
|
manufactory_1
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Manufacturers ( Code, Name, Headquarter, Founder, Revenue )
# Products ( Code, Name, Price, Manufacturer )
#
# Products.Manufacturer can be joined with Manufacturers.Code
#
### Question:
#
# How many products have prices of at least 180?
#
### SQL:
#
# SELECT count(*) FROM products WHERE price >= 180
#
### End.
|
manufactory_1
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Manufacturers ( Code, Name, Headquarter, Founder, Revenue )
# Products ( Code, Name, Price, Manufacturer )
#
# Products.Manufacturer can be joined with Manufacturers.Code
#
### Question:
#
# Select the name and price of all products with a price larger than or equal to $180, and sort first by price (in descending order), and then by name (in ascending order).
#
### SQL:
#
# SELECT name , price FROM products WHERE price >= 180 ORDER BY price DESC , name ASC
#
### End.
|
manufactory_1
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Manufacturers ( Code, Name, Headquarter, Founder, Revenue )
# Products ( Code, Name, Price, Manufacturer )
#
# Products.Manufacturer can be joined with Manufacturers.Code
#
### Question:
#
# What are the names and prices of products that cost at least 180, sorted by price decreasing and name ascending?
#
### SQL:
#
# SELECT name , price FROM products WHERE price >= 180 ORDER BY price DESC , name ASC
#
### End.
|
manufactory_1
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Manufacturers ( Code, Name, Headquarter, Founder, Revenue )
# Products ( Code, Name, Price, Manufacturer )
#
# Products.Manufacturer can be joined with Manufacturers.Code
#
### Question:
#
# Select all the data from the products and each product's manufacturer.
#
### SQL:
#
# SELECT * FROM products AS T1 JOIN Manufacturers AS T2 ON T1.manufacturer = T2.code
#
### End.
|
manufactory_1
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Manufacturers ( Code, Name, Headquarter, Founder, Revenue )
# Products ( Code, Name, Price, Manufacturer )
#
# Products.Manufacturer can be joined with Manufacturers.Code
#
### Question:
#
# What is all the product data, as well as each product's manufacturer?
#
### SQL:
#
# SELECT * FROM products AS T1 JOIN Manufacturers AS T2 ON T1.manufacturer = T2.code
#
### End.
|
manufactory_1
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Manufacturers ( Code, Name, Headquarter, Founder, Revenue )
# Products ( Code, Name, Price, Manufacturer )
#
# Products.Manufacturer can be joined with Manufacturers.Code
#
### Question:
#
# Select the average price of each manufacturer's products, showing only the manufacturer's code.
#
### SQL:
#
# SELECT AVG(Price) , Manufacturer FROM Products GROUP BY Manufacturer
#
### End.
|
manufactory_1
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Manufacturers ( Code, Name, Headquarter, Founder, Revenue )
# Products ( Code, Name, Price, Manufacturer )
#
# Products.Manufacturer can be joined with Manufacturers.Code
#
### Question:
#
# What are the average prices of products, grouped by manufacturer code?
#
### SQL:
#
# SELECT AVG(Price) , Manufacturer FROM Products GROUP BY Manufacturer
#
### End.
|
manufactory_1
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Manufacturers ( Code, Name, Headquarter, Founder, Revenue )
# Products ( Code, Name, Price, Manufacturer )
#
# Products.Manufacturer can be joined with Manufacturers.Code
#
### Question:
#
# Select the average price of each manufacturer's products, showing the manufacturer's name.
#
### SQL:
#
# SELECT avg(T1.Price) , T2.name FROM products AS T1 JOIN Manufacturers AS T2 ON T1.manufacturer = T2.code GROUP BY T2.name
#
### End.
|
manufactory_1
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Manufacturers ( Code, Name, Headquarter, Founder, Revenue )
# Products ( Code, Name, Price, Manufacturer )
#
# Products.Manufacturer can be joined with Manufacturers.Code
#
### Question:
#
# What are the average prices of products, grouped by manufacturer name?
#
### SQL:
#
# SELECT avg(T1.Price) , T2.name FROM products AS T1 JOIN Manufacturers AS T2 ON T1.manufacturer = T2.code GROUP BY T2.name
#
### End.
|
manufactory_1
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Manufacturers ( Code, Name, Headquarter, Founder, Revenue )
# Products ( Code, Name, Price, Manufacturer )
#
# Products.Manufacturer can be joined with Manufacturers.Code
#
### Question:
#
# Select the names of manufacturer whose products have an average price higher than or equal to $150.
#
### SQL:
#
# SELECT avg(T1.Price) , T2.name FROM products AS T1 JOIN Manufacturers AS T2 ON T1.manufacturer = T2.code GROUP BY T2.name HAVING avg(T1.price) >= 150
#
### End.
|
manufactory_1
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Manufacturers ( Code, Name, Headquarter, Founder, Revenue )
# Products ( Code, Name, Price, Manufacturer )
#
# Products.Manufacturer can be joined with Manufacturers.Code
#
### Question:
#
# What are the names and average prices of products for manufacturers whose products cost on average 150 or more?
#
### SQL:
#
# SELECT avg(T1.Price) , T2.name FROM products AS T1 JOIN Manufacturers AS T2 ON T1.manufacturer = T2.code GROUP BY T2.name HAVING avg(T1.price) >= 150
#
### End.
|
manufactory_1
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Manufacturers ( Code, Name, Headquarter, Founder, Revenue )
# Products ( Code, Name, Price, Manufacturer )
#
# Products.Manufacturer can be joined with Manufacturers.Code
#
### Question:
#
# Select the name and price of the cheapest product.
#
### SQL:
#
# SELECT name , price FROM Products ORDER BY price ASC LIMIT 1
#
### End.
|
manufactory_1
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Manufacturers ( Code, Name, Headquarter, Founder, Revenue )
# Products ( Code, Name, Price, Manufacturer )
#
# Products.Manufacturer can be joined with Manufacturers.Code
#
### Question:
#
# What is the name and price of the cheapest product?
#
### SQL:
#
# SELECT name , price FROM Products ORDER BY price ASC LIMIT 1
#
### End.
|
manufactory_1
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Manufacturers ( Code, Name, Headquarter, Founder, Revenue )
# Products ( Code, Name, Price, Manufacturer )
#
# Products.Manufacturer can be joined with Manufacturers.Code
#
### Question:
#
# Select the name of each manufacturer along with the name and price of its most expensive product.
#
### SQL:
#
# SELECT T1.Name , max(T1.Price) , T2.name FROM products AS T1 JOIN Manufacturers AS T2 ON T1.manufacturer = T2.code GROUP BY T2.name
#
### End.
|
manufactory_1
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Manufacturers ( Code, Name, Headquarter, Founder, Revenue )
# Products ( Code, Name, Price, Manufacturer )
#
# Products.Manufacturer can be joined with Manufacturers.Code
#
### Question:
#
# For each manufacturer name, what are the names and prices of their most expensive product?
#
### SQL:
#
# SELECT T1.Name , max(T1.Price) , T2.name FROM products AS T1 JOIN Manufacturers AS T2 ON T1.manufacturer = T2.code GROUP BY T2.name
#
### End.
|
manufactory_1
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Manufacturers ( Code, Name, Headquarter, Founder, Revenue )
# Products ( Code, Name, Price, Manufacturer )
#
# Products.Manufacturer can be joined with Manufacturers.Code
#
### Question:
#
# Select the code of the product that is cheapest in each product category.
#
### SQL:
#
# SELECT code , name , min(price) FROM products GROUP BY name
#
### End.
|
manufactory_1
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Manufacturers ( Code, Name, Headquarter, Founder, Revenue )
# Products ( Code, Name, Price, Manufacturer )
#
# Products.Manufacturer can be joined with Manufacturers.Code
#
### Question:
#
# What are the codes and names of the cheapest products in each category?
#
### SQL:
#
# SELECT code , name , min(price) FROM products GROUP BY name
#
### End.
|
tracking_software_problems
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Problem_Category_Codes ( problem_category_code, problem_category_description )
# Problem_Log ( problem_log_id, assigned_to_staff_id, problem_id, problem_category_code, problem_status_code, log_entry_date, log_entry_description, log_entry_fix, other_log_details )
# Problem_Status_Codes ( problem_status_code, problem_status_description )
# Product ( product_id, product_name, product_details )
# Staff ( staff_id, staff_first_name, staff_last_name, other_staff_details )
# Problems ( problem_id, product_id, closure_authorised_by_staff_id, reported_by_staff_id, date_problem_reported, date_problem_closed, problem_description, other_problem_details )
#
# Problem_Log.problem_status_code can be joined with Problem_Status_Codes.problem_status_code
# Problem_Log.problem_id can be joined with Problems.problem_id
# Problem_Log.assigned_to_staff_id can be joined with Staff.staff_id
# Problem_Log.problem_category_code can be joined with Problem_Category_Codes.problem_category_code
# Problems.reported_by_staff_id can be joined with Staff.staff_id
# Problems.product_id can be joined with Product.product_id
# Problems.closure_authorised_by_staff_id can be joined with Staff.staff_id
#
### Question:
#
# What is the id of the problem log that is created most recently?
#
### SQL:
#
# SELECT problem_log_id FROM problem_log ORDER BY log_entry_date DESC LIMIT 1
#
### End.
|
tracking_software_problems
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Problem_Category_Codes ( problem_category_code, problem_category_description )
# Problem_Log ( problem_log_id, assigned_to_staff_id, problem_id, problem_category_code, problem_status_code, log_entry_date, log_entry_description, log_entry_fix, other_log_details )
# Problem_Status_Codes ( problem_status_code, problem_status_description )
# Product ( product_id, product_name, product_details )
# Staff ( staff_id, staff_first_name, staff_last_name, other_staff_details )
# Problems ( problem_id, product_id, closure_authorised_by_staff_id, reported_by_staff_id, date_problem_reported, date_problem_closed, problem_description, other_problem_details )
#
# Problem_Log.problem_status_code can be joined with Problem_Status_Codes.problem_status_code
# Problem_Log.problem_id can be joined with Problems.problem_id
# Problem_Log.assigned_to_staff_id can be joined with Staff.staff_id
# Problem_Log.problem_category_code can be joined with Problem_Category_Codes.problem_category_code
# Problems.reported_by_staff_id can be joined with Staff.staff_id
# Problems.product_id can be joined with Product.product_id
# Problems.closure_authorised_by_staff_id can be joined with Staff.staff_id
#
### Question:
#
# Which problem log was created most recently? Give me the log id.
#
### SQL:
#
# SELECT problem_log_id FROM problem_log ORDER BY log_entry_date DESC LIMIT 1
#
### End.
|
tracking_software_problems
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Problem_Category_Codes ( problem_category_code, problem_category_description )
# Problem_Log ( problem_log_id, assigned_to_staff_id, problem_id, problem_category_code, problem_status_code, log_entry_date, log_entry_description, log_entry_fix, other_log_details )
# Problem_Status_Codes ( problem_status_code, problem_status_description )
# Product ( product_id, product_name, product_details )
# Staff ( staff_id, staff_first_name, staff_last_name, other_staff_details )
# Problems ( problem_id, product_id, closure_authorised_by_staff_id, reported_by_staff_id, date_problem_reported, date_problem_closed, problem_description, other_problem_details )
#
# Problem_Log.problem_status_code can be joined with Problem_Status_Codes.problem_status_code
# Problem_Log.problem_id can be joined with Problems.problem_id
# Problem_Log.assigned_to_staff_id can be joined with Staff.staff_id
# Problem_Log.problem_category_code can be joined with Problem_Category_Codes.problem_category_code
# Problems.reported_by_staff_id can be joined with Staff.staff_id
# Problems.product_id can be joined with Product.product_id
# Problems.closure_authorised_by_staff_id can be joined with Staff.staff_id
#
### Question:
#
# What is the oldest log id and its corresponding problem id?
#
### SQL:
#
# SELECT problem_log_id , problem_id FROM problem_log ORDER BY log_entry_date LIMIT 1
#
### End.
|
tracking_software_problems
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Problem_Category_Codes ( problem_category_code, problem_category_description )
# Problem_Log ( problem_log_id, assigned_to_staff_id, problem_id, problem_category_code, problem_status_code, log_entry_date, log_entry_description, log_entry_fix, other_log_details )
# Problem_Status_Codes ( problem_status_code, problem_status_description )
# Product ( product_id, product_name, product_details )
# Staff ( staff_id, staff_first_name, staff_last_name, other_staff_details )
# Problems ( problem_id, product_id, closure_authorised_by_staff_id, reported_by_staff_id, date_problem_reported, date_problem_closed, problem_description, other_problem_details )
#
# Problem_Log.problem_status_code can be joined with Problem_Status_Codes.problem_status_code
# Problem_Log.problem_id can be joined with Problems.problem_id
# Problem_Log.assigned_to_staff_id can be joined with Staff.staff_id
# Problem_Log.problem_category_code can be joined with Problem_Category_Codes.problem_category_code
# Problems.reported_by_staff_id can be joined with Staff.staff_id
# Problems.product_id can be joined with Product.product_id
# Problems.closure_authorised_by_staff_id can be joined with Staff.staff_id
#
### Question:
#
# Find the oldest log id and its corresponding problem id.
#
### SQL:
#
# SELECT problem_log_id , problem_id FROM problem_log ORDER BY log_entry_date LIMIT 1
#
### End.
|
tracking_software_problems
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Problem_Category_Codes ( problem_category_code, problem_category_description )
# Problem_Log ( problem_log_id, assigned_to_staff_id, problem_id, problem_category_code, problem_status_code, log_entry_date, log_entry_description, log_entry_fix, other_log_details )
# Problem_Status_Codes ( problem_status_code, problem_status_description )
# Product ( product_id, product_name, product_details )
# Staff ( staff_id, staff_first_name, staff_last_name, other_staff_details )
# Problems ( problem_id, product_id, closure_authorised_by_staff_id, reported_by_staff_id, date_problem_reported, date_problem_closed, problem_description, other_problem_details )
#
# Problem_Log.problem_status_code can be joined with Problem_Status_Codes.problem_status_code
# Problem_Log.problem_id can be joined with Problems.problem_id
# Problem_Log.assigned_to_staff_id can be joined with Staff.staff_id
# Problem_Log.problem_category_code can be joined with Problem_Category_Codes.problem_category_code
# Problems.reported_by_staff_id can be joined with Staff.staff_id
# Problems.product_id can be joined with Product.product_id
# Problems.closure_authorised_by_staff_id can be joined with Staff.staff_id
#
### Question:
#
# Find all the ids and dates of the logs for the problem whose id is 10.
#
### SQL:
#
# SELECT problem_log_id , log_entry_date FROM problem_log WHERE problem_id = 10
#
### End.
|
tracking_software_problems
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Problem_Category_Codes ( problem_category_code, problem_category_description )
# Problem_Log ( problem_log_id, assigned_to_staff_id, problem_id, problem_category_code, problem_status_code, log_entry_date, log_entry_description, log_entry_fix, other_log_details )
# Problem_Status_Codes ( problem_status_code, problem_status_description )
# Product ( product_id, product_name, product_details )
# Staff ( staff_id, staff_first_name, staff_last_name, other_staff_details )
# Problems ( problem_id, product_id, closure_authorised_by_staff_id, reported_by_staff_id, date_problem_reported, date_problem_closed, problem_description, other_problem_details )
#
# Problem_Log.problem_status_code can be joined with Problem_Status_Codes.problem_status_code
# Problem_Log.problem_id can be joined with Problems.problem_id
# Problem_Log.assigned_to_staff_id can be joined with Staff.staff_id
# Problem_Log.problem_category_code can be joined with Problem_Category_Codes.problem_category_code
# Problems.reported_by_staff_id can be joined with Staff.staff_id
# Problems.product_id can be joined with Product.product_id
# Problems.closure_authorised_by_staff_id can be joined with Staff.staff_id
#
### Question:
#
# For the problem with id 10, return the ids and dates of its problem logs.
#
### SQL:
#
# SELECT problem_log_id , log_entry_date FROM problem_log WHERE problem_id = 10
#
### End.
|
tracking_software_problems
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Problem_Category_Codes ( problem_category_code, problem_category_description )
# Problem_Log ( problem_log_id, assigned_to_staff_id, problem_id, problem_category_code, problem_status_code, log_entry_date, log_entry_description, log_entry_fix, other_log_details )
# Problem_Status_Codes ( problem_status_code, problem_status_description )
# Product ( product_id, product_name, product_details )
# Staff ( staff_id, staff_first_name, staff_last_name, other_staff_details )
# Problems ( problem_id, product_id, closure_authorised_by_staff_id, reported_by_staff_id, date_problem_reported, date_problem_closed, problem_description, other_problem_details )
#
# Problem_Log.problem_status_code can be joined with Problem_Status_Codes.problem_status_code
# Problem_Log.problem_id can be joined with Problems.problem_id
# Problem_Log.assigned_to_staff_id can be joined with Staff.staff_id
# Problem_Log.problem_category_code can be joined with Problem_Category_Codes.problem_category_code
# Problems.reported_by_staff_id can be joined with Staff.staff_id
# Problems.product_id can be joined with Product.product_id
# Problems.closure_authorised_by_staff_id can be joined with Staff.staff_id
#
### Question:
#
# List all the log ids and their descriptions from the problem logs.
#
### SQL:
#
# SELECT problem_log_id , log_entry_description FROM problem_log
#
### End.
|
tracking_software_problems
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Problem_Category_Codes ( problem_category_code, problem_category_description )
# Problem_Log ( problem_log_id, assigned_to_staff_id, problem_id, problem_category_code, problem_status_code, log_entry_date, log_entry_description, log_entry_fix, other_log_details )
# Problem_Status_Codes ( problem_status_code, problem_status_description )
# Product ( product_id, product_name, product_details )
# Staff ( staff_id, staff_first_name, staff_last_name, other_staff_details )
# Problems ( problem_id, product_id, closure_authorised_by_staff_id, reported_by_staff_id, date_problem_reported, date_problem_closed, problem_description, other_problem_details )
#
# Problem_Log.problem_status_code can be joined with Problem_Status_Codes.problem_status_code
# Problem_Log.problem_id can be joined with Problems.problem_id
# Problem_Log.assigned_to_staff_id can be joined with Staff.staff_id
# Problem_Log.problem_category_code can be joined with Problem_Category_Codes.problem_category_code
# Problems.reported_by_staff_id can be joined with Staff.staff_id
# Problems.product_id can be joined with Product.product_id
# Problems.closure_authorised_by_staff_id can be joined with Staff.staff_id
#
### Question:
#
# What are the log id and entry description of each problem?
#
### SQL:
#
# SELECT problem_log_id , log_entry_description FROM problem_log
#
### End.
|
tracking_software_problems
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Problem_Category_Codes ( problem_category_code, problem_category_description )
# Problem_Log ( problem_log_id, assigned_to_staff_id, problem_id, problem_category_code, problem_status_code, log_entry_date, log_entry_description, log_entry_fix, other_log_details )
# Problem_Status_Codes ( problem_status_code, problem_status_description )
# Product ( product_id, product_name, product_details )
# Staff ( staff_id, staff_first_name, staff_last_name, other_staff_details )
# Problems ( problem_id, product_id, closure_authorised_by_staff_id, reported_by_staff_id, date_problem_reported, date_problem_closed, problem_description, other_problem_details )
#
# Problem_Log.problem_status_code can be joined with Problem_Status_Codes.problem_status_code
# Problem_Log.problem_id can be joined with Problems.problem_id
# Problem_Log.assigned_to_staff_id can be joined with Staff.staff_id
# Problem_Log.problem_category_code can be joined with Problem_Category_Codes.problem_category_code
# Problems.reported_by_staff_id can be joined with Staff.staff_id
# Problems.product_id can be joined with Product.product_id
# Problems.closure_authorised_by_staff_id can be joined with Staff.staff_id
#
### Question:
#
# List the first and last names of all distinct staff members who are assigned to the problem whose id is 1.
#
### SQL:
#
# SELECT DISTINCT staff_first_name , staff_last_name FROM staff AS T1 JOIN problem_log AS T2 ON T1.staff_id = T2.assigned_to_staff_id WHERE T2.problem_id = 1
#
### End.
|
tracking_software_problems
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Problem_Category_Codes ( problem_category_code, problem_category_description )
# Problem_Log ( problem_log_id, assigned_to_staff_id, problem_id, problem_category_code, problem_status_code, log_entry_date, log_entry_description, log_entry_fix, other_log_details )
# Problem_Status_Codes ( problem_status_code, problem_status_description )
# Product ( product_id, product_name, product_details )
# Staff ( staff_id, staff_first_name, staff_last_name, other_staff_details )
# Problems ( problem_id, product_id, closure_authorised_by_staff_id, reported_by_staff_id, date_problem_reported, date_problem_closed, problem_description, other_problem_details )
#
# Problem_Log.problem_status_code can be joined with Problem_Status_Codes.problem_status_code
# Problem_Log.problem_id can be joined with Problems.problem_id
# Problem_Log.assigned_to_staff_id can be joined with Staff.staff_id
# Problem_Log.problem_category_code can be joined with Problem_Category_Codes.problem_category_code
# Problems.reported_by_staff_id can be joined with Staff.staff_id
# Problems.product_id can be joined with Product.product_id
# Problems.closure_authorised_by_staff_id can be joined with Staff.staff_id
#
### Question:
#
# Which staff members are assigned to the problem with id 1? Give me their first and last names.
#
### SQL:
#
# SELECT DISTINCT staff_first_name , staff_last_name FROM staff AS T1 JOIN problem_log AS T2 ON T1.staff_id = T2.assigned_to_staff_id WHERE T2.problem_id = 1
#
### End.
|
tracking_software_problems
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Problem_Category_Codes ( problem_category_code, problem_category_description )
# Problem_Log ( problem_log_id, assigned_to_staff_id, problem_id, problem_category_code, problem_status_code, log_entry_date, log_entry_description, log_entry_fix, other_log_details )
# Problem_Status_Codes ( problem_status_code, problem_status_description )
# Product ( product_id, product_name, product_details )
# Staff ( staff_id, staff_first_name, staff_last_name, other_staff_details )
# Problems ( problem_id, product_id, closure_authorised_by_staff_id, reported_by_staff_id, date_problem_reported, date_problem_closed, problem_description, other_problem_details )
#
# Problem_Log.problem_status_code can be joined with Problem_Status_Codes.problem_status_code
# Problem_Log.problem_id can be joined with Problems.problem_id
# Problem_Log.assigned_to_staff_id can be joined with Staff.staff_id
# Problem_Log.problem_category_code can be joined with Problem_Category_Codes.problem_category_code
# Problems.reported_by_staff_id can be joined with Staff.staff_id
# Problems.product_id can be joined with Product.product_id
# Problems.closure_authorised_by_staff_id can be joined with Staff.staff_id
#
### Question:
#
# List the problem id and log id which are assigned to the staff named Rylan Homenick.
#
### SQL:
#
# SELECT DISTINCT T2.problem_id , T2.problem_log_id FROM staff AS T1 JOIN problem_log AS T2 ON T1.staff_id = T2.assigned_to_staff_id WHERE T1.staff_first_name = "Rylan" AND T1.staff_last_name = "Homenick"
#
### End.
|
tracking_software_problems
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Problem_Category_Codes ( problem_category_code, problem_category_description )
# Problem_Log ( problem_log_id, assigned_to_staff_id, problem_id, problem_category_code, problem_status_code, log_entry_date, log_entry_description, log_entry_fix, other_log_details )
# Problem_Status_Codes ( problem_status_code, problem_status_description )
# Product ( product_id, product_name, product_details )
# Staff ( staff_id, staff_first_name, staff_last_name, other_staff_details )
# Problems ( problem_id, product_id, closure_authorised_by_staff_id, reported_by_staff_id, date_problem_reported, date_problem_closed, problem_description, other_problem_details )
#
# Problem_Log.problem_status_code can be joined with Problem_Status_Codes.problem_status_code
# Problem_Log.problem_id can be joined with Problems.problem_id
# Problem_Log.assigned_to_staff_id can be joined with Staff.staff_id
# Problem_Log.problem_category_code can be joined with Problem_Category_Codes.problem_category_code
# Problems.reported_by_staff_id can be joined with Staff.staff_id
# Problems.product_id can be joined with Product.product_id
# Problems.closure_authorised_by_staff_id can be joined with Staff.staff_id
#
### Question:
#
# Which problem id and log id are assigned to the staff named Rylan Homenick?
#
### SQL:
#
# SELECT DISTINCT T2.problem_id , T2.problem_log_id FROM staff AS T1 JOIN problem_log AS T2 ON T1.staff_id = T2.assigned_to_staff_id WHERE T1.staff_first_name = "Rylan" AND T1.staff_last_name = "Homenick"
#
### End.
|
tracking_software_problems
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Problem_Category_Codes ( problem_category_code, problem_category_description )
# Problem_Log ( problem_log_id, assigned_to_staff_id, problem_id, problem_category_code, problem_status_code, log_entry_date, log_entry_description, log_entry_fix, other_log_details )
# Problem_Status_Codes ( problem_status_code, problem_status_description )
# Product ( product_id, product_name, product_details )
# Staff ( staff_id, staff_first_name, staff_last_name, other_staff_details )
# Problems ( problem_id, product_id, closure_authorised_by_staff_id, reported_by_staff_id, date_problem_reported, date_problem_closed, problem_description, other_problem_details )
#
# Problem_Log.problem_status_code can be joined with Problem_Status_Codes.problem_status_code
# Problem_Log.problem_id can be joined with Problems.problem_id
# Problem_Log.assigned_to_staff_id can be joined with Staff.staff_id
# Problem_Log.problem_category_code can be joined with Problem_Category_Codes.problem_category_code
# Problems.reported_by_staff_id can be joined with Staff.staff_id
# Problems.product_id can be joined with Product.product_id
# Problems.closure_authorised_by_staff_id can be joined with Staff.staff_id
#
### Question:
#
# How many problems are there for product voluptatem?
#
### SQL:
#
# SELECT count(*) FROM product AS T1 JOIN problems AS T2 ON T1.product_id = T2.product_id WHERE T1.product_name = "voluptatem"
#
### End.
|
tracking_software_problems
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Problem_Category_Codes ( problem_category_code, problem_category_description )
# Problem_Log ( problem_log_id, assigned_to_staff_id, problem_id, problem_category_code, problem_status_code, log_entry_date, log_entry_description, log_entry_fix, other_log_details )
# Problem_Status_Codes ( problem_status_code, problem_status_description )
# Product ( product_id, product_name, product_details )
# Staff ( staff_id, staff_first_name, staff_last_name, other_staff_details )
# Problems ( problem_id, product_id, closure_authorised_by_staff_id, reported_by_staff_id, date_problem_reported, date_problem_closed, problem_description, other_problem_details )
#
# Problem_Log.problem_status_code can be joined with Problem_Status_Codes.problem_status_code
# Problem_Log.problem_id can be joined with Problems.problem_id
# Problem_Log.assigned_to_staff_id can be joined with Staff.staff_id
# Problem_Log.problem_category_code can be joined with Problem_Category_Codes.problem_category_code
# Problems.reported_by_staff_id can be joined with Staff.staff_id
# Problems.product_id can be joined with Product.product_id
# Problems.closure_authorised_by_staff_id can be joined with Staff.staff_id
#
### Question:
#
# How many problems did the product called "voluptatem" have in record?
#
### SQL:
#
# SELECT count(*) FROM product AS T1 JOIN problems AS T2 ON T1.product_id = T2.product_id WHERE T1.product_name = "voluptatem"
#
### End.
|
tracking_software_problems
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Problem_Category_Codes ( problem_category_code, problem_category_description )
# Problem_Log ( problem_log_id, assigned_to_staff_id, problem_id, problem_category_code, problem_status_code, log_entry_date, log_entry_description, log_entry_fix, other_log_details )
# Problem_Status_Codes ( problem_status_code, problem_status_description )
# Product ( product_id, product_name, product_details )
# Staff ( staff_id, staff_first_name, staff_last_name, other_staff_details )
# Problems ( problem_id, product_id, closure_authorised_by_staff_id, reported_by_staff_id, date_problem_reported, date_problem_closed, problem_description, other_problem_details )
#
# Problem_Log.problem_status_code can be joined with Problem_Status_Codes.problem_status_code
# Problem_Log.problem_id can be joined with Problems.problem_id
# Problem_Log.assigned_to_staff_id can be joined with Staff.staff_id
# Problem_Log.problem_category_code can be joined with Problem_Category_Codes.problem_category_code
# Problems.reported_by_staff_id can be joined with Staff.staff_id
# Problems.product_id can be joined with Product.product_id
# Problems.closure_authorised_by_staff_id can be joined with Staff.staff_id
#
### Question:
#
# How many problems does the product with the most problems have? List the number of the problems and product name.
#
### SQL:
#
# SELECT count(*) , T1.product_name FROM product AS T1 JOIN problems AS T2 ON T1.product_id = T2.product_id GROUP BY T1.product_name ORDER BY count(*) DESC LIMIT 1
#
### End.
|
tracking_software_problems
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Problem_Category_Codes ( problem_category_code, problem_category_description )
# Problem_Log ( problem_log_id, assigned_to_staff_id, problem_id, problem_category_code, problem_status_code, log_entry_date, log_entry_description, log_entry_fix, other_log_details )
# Problem_Status_Codes ( problem_status_code, problem_status_description )
# Product ( product_id, product_name, product_details )
# Staff ( staff_id, staff_first_name, staff_last_name, other_staff_details )
# Problems ( problem_id, product_id, closure_authorised_by_staff_id, reported_by_staff_id, date_problem_reported, date_problem_closed, problem_description, other_problem_details )
#
# Problem_Log.problem_status_code can be joined with Problem_Status_Codes.problem_status_code
# Problem_Log.problem_id can be joined with Problems.problem_id
# Problem_Log.assigned_to_staff_id can be joined with Staff.staff_id
# Problem_Log.problem_category_code can be joined with Problem_Category_Codes.problem_category_code
# Problems.reported_by_staff_id can be joined with Staff.staff_id
# Problems.product_id can be joined with Product.product_id
# Problems.closure_authorised_by_staff_id can be joined with Staff.staff_id
#
### Question:
#
# Which product has the most problems? Give me the number of problems and the product name.
#
### SQL:
#
# SELECT count(*) , T1.product_name FROM product AS T1 JOIN problems AS T2 ON T1.product_id = T2.product_id GROUP BY T1.product_name ORDER BY count(*) DESC LIMIT 1
#
### End.
|
tracking_software_problems
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Problem_Category_Codes ( problem_category_code, problem_category_description )
# Problem_Log ( problem_log_id, assigned_to_staff_id, problem_id, problem_category_code, problem_status_code, log_entry_date, log_entry_description, log_entry_fix, other_log_details )
# Problem_Status_Codes ( problem_status_code, problem_status_description )
# Product ( product_id, product_name, product_details )
# Staff ( staff_id, staff_first_name, staff_last_name, other_staff_details )
# Problems ( problem_id, product_id, closure_authorised_by_staff_id, reported_by_staff_id, date_problem_reported, date_problem_closed, problem_description, other_problem_details )
#
# Problem_Log.problem_status_code can be joined with Problem_Status_Codes.problem_status_code
# Problem_Log.problem_id can be joined with Problems.problem_id
# Problem_Log.assigned_to_staff_id can be joined with Staff.staff_id
# Problem_Log.problem_category_code can be joined with Problem_Category_Codes.problem_category_code
# Problems.reported_by_staff_id can be joined with Staff.staff_id
# Problems.product_id can be joined with Product.product_id
# Problems.closure_authorised_by_staff_id can be joined with Staff.staff_id
#
### Question:
#
# Give me a list of descriptions of the problems that are reported by the staff whose first name is Christop.
#
### SQL:
#
# SELECT T1.problem_description FROM problems AS T1 JOIN staff AS T2 ON T1.reported_by_staff_id = T2.staff_id WHERE T2.staff_first_name = "Christop"
#
### End.
|
tracking_software_problems
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Problem_Category_Codes ( problem_category_code, problem_category_description )
# Problem_Log ( problem_log_id, assigned_to_staff_id, problem_id, problem_category_code, problem_status_code, log_entry_date, log_entry_description, log_entry_fix, other_log_details )
# Problem_Status_Codes ( problem_status_code, problem_status_description )
# Product ( product_id, product_name, product_details )
# Staff ( staff_id, staff_first_name, staff_last_name, other_staff_details )
# Problems ( problem_id, product_id, closure_authorised_by_staff_id, reported_by_staff_id, date_problem_reported, date_problem_closed, problem_description, other_problem_details )
#
# Problem_Log.problem_status_code can be joined with Problem_Status_Codes.problem_status_code
# Problem_Log.problem_id can be joined with Problems.problem_id
# Problem_Log.assigned_to_staff_id can be joined with Staff.staff_id
# Problem_Log.problem_category_code can be joined with Problem_Category_Codes.problem_category_code
# Problems.reported_by_staff_id can be joined with Staff.staff_id
# Problems.product_id can be joined with Product.product_id
# Problems.closure_authorised_by_staff_id can be joined with Staff.staff_id
#
### Question:
#
# Which problems are reported by the staff with first name "Christop"? Show the descriptions of the problems.
#
### SQL:
#
# SELECT T1.problem_description FROM problems AS T1 JOIN staff AS T2 ON T1.reported_by_staff_id = T2.staff_id WHERE T2.staff_first_name = "Christop"
#
### End.
|
tracking_software_problems
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Problem_Category_Codes ( problem_category_code, problem_category_description )
# Problem_Log ( problem_log_id, assigned_to_staff_id, problem_id, problem_category_code, problem_status_code, log_entry_date, log_entry_description, log_entry_fix, other_log_details )
# Problem_Status_Codes ( problem_status_code, problem_status_description )
# Product ( product_id, product_name, product_details )
# Staff ( staff_id, staff_first_name, staff_last_name, other_staff_details )
# Problems ( problem_id, product_id, closure_authorised_by_staff_id, reported_by_staff_id, date_problem_reported, date_problem_closed, problem_description, other_problem_details )
#
# Problem_Log.problem_status_code can be joined with Problem_Status_Codes.problem_status_code
# Problem_Log.problem_id can be joined with Problems.problem_id
# Problem_Log.assigned_to_staff_id can be joined with Staff.staff_id
# Problem_Log.problem_category_code can be joined with Problem_Category_Codes.problem_category_code
# Problems.reported_by_staff_id can be joined with Staff.staff_id
# Problems.product_id can be joined with Product.product_id
# Problems.closure_authorised_by_staff_id can be joined with Staff.staff_id
#
### Question:
#
# Find the ids of the problems that are reported by the staff whose last name is Bosco.
#
### SQL:
#
# SELECT T1.problem_id FROM problems AS T1 JOIN staff AS T2 ON T1.reported_by_staff_id = T2.staff_id WHERE T2.staff_last_name = "Bosco"
#
### End.
|
tracking_software_problems
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Problem_Category_Codes ( problem_category_code, problem_category_description )
# Problem_Log ( problem_log_id, assigned_to_staff_id, problem_id, problem_category_code, problem_status_code, log_entry_date, log_entry_description, log_entry_fix, other_log_details )
# Problem_Status_Codes ( problem_status_code, problem_status_description )
# Product ( product_id, product_name, product_details )
# Staff ( staff_id, staff_first_name, staff_last_name, other_staff_details )
# Problems ( problem_id, product_id, closure_authorised_by_staff_id, reported_by_staff_id, date_problem_reported, date_problem_closed, problem_description, other_problem_details )
#
# Problem_Log.problem_status_code can be joined with Problem_Status_Codes.problem_status_code
# Problem_Log.problem_id can be joined with Problems.problem_id
# Problem_Log.assigned_to_staff_id can be joined with Staff.staff_id
# Problem_Log.problem_category_code can be joined with Problem_Category_Codes.problem_category_code
# Problems.reported_by_staff_id can be joined with Staff.staff_id
# Problems.product_id can be joined with Product.product_id
# Problems.closure_authorised_by_staff_id can be joined with Staff.staff_id
#
### Question:
#
# Which problems are reported by the staff with last name "Bosco"? Show the ids of the problems.
#
### SQL:
#
# SELECT T1.problem_id FROM problems AS T1 JOIN staff AS T2 ON T1.reported_by_staff_id = T2.staff_id WHERE T2.staff_last_name = "Bosco"
#
### End.
|
tracking_software_problems
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Problem_Category_Codes ( problem_category_code, problem_category_description )
# Problem_Log ( problem_log_id, assigned_to_staff_id, problem_id, problem_category_code, problem_status_code, log_entry_date, log_entry_description, log_entry_fix, other_log_details )
# Problem_Status_Codes ( problem_status_code, problem_status_description )
# Product ( product_id, product_name, product_details )
# Staff ( staff_id, staff_first_name, staff_last_name, other_staff_details )
# Problems ( problem_id, product_id, closure_authorised_by_staff_id, reported_by_staff_id, date_problem_reported, date_problem_closed, problem_description, other_problem_details )
#
# Problem_Log.problem_status_code can be joined with Problem_Status_Codes.problem_status_code
# Problem_Log.problem_id can be joined with Problems.problem_id
# Problem_Log.assigned_to_staff_id can be joined with Staff.staff_id
# Problem_Log.problem_category_code can be joined with Problem_Category_Codes.problem_category_code
# Problems.reported_by_staff_id can be joined with Staff.staff_id
# Problems.product_id can be joined with Product.product_id
# Problems.closure_authorised_by_staff_id can be joined with Staff.staff_id
#
### Question:
#
# What are the ids of the problems which are reported after 1978-06-26?
#
### SQL:
#
# SELECT problem_id FROM problems WHERE date_problem_reported > "1978-06-26"
#
### End.
|
tracking_software_problems
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Problem_Category_Codes ( problem_category_code, problem_category_description )
# Problem_Log ( problem_log_id, assigned_to_staff_id, problem_id, problem_category_code, problem_status_code, log_entry_date, log_entry_description, log_entry_fix, other_log_details )
# Problem_Status_Codes ( problem_status_code, problem_status_description )
# Product ( product_id, product_name, product_details )
# Staff ( staff_id, staff_first_name, staff_last_name, other_staff_details )
# Problems ( problem_id, product_id, closure_authorised_by_staff_id, reported_by_staff_id, date_problem_reported, date_problem_closed, problem_description, other_problem_details )
#
# Problem_Log.problem_status_code can be joined with Problem_Status_Codes.problem_status_code
# Problem_Log.problem_id can be joined with Problems.problem_id
# Problem_Log.assigned_to_staff_id can be joined with Staff.staff_id
# Problem_Log.problem_category_code can be joined with Problem_Category_Codes.problem_category_code
# Problems.reported_by_staff_id can be joined with Staff.staff_id
# Problems.product_id can be joined with Product.product_id
# Problems.closure_authorised_by_staff_id can be joined with Staff.staff_id
#
### Question:
#
# Find the ids of the problems reported after 1978-06-26.
#
### SQL:
#
# SELECT problem_id FROM problems WHERE date_problem_reported > "1978-06-26"
#
### End.
|
tracking_software_problems
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Problem_Category_Codes ( problem_category_code, problem_category_description )
# Problem_Log ( problem_log_id, assigned_to_staff_id, problem_id, problem_category_code, problem_status_code, log_entry_date, log_entry_description, log_entry_fix, other_log_details )
# Problem_Status_Codes ( problem_status_code, problem_status_description )
# Product ( product_id, product_name, product_details )
# Staff ( staff_id, staff_first_name, staff_last_name, other_staff_details )
# Problems ( problem_id, product_id, closure_authorised_by_staff_id, reported_by_staff_id, date_problem_reported, date_problem_closed, problem_description, other_problem_details )
#
# Problem_Log.problem_status_code can be joined with Problem_Status_Codes.problem_status_code
# Problem_Log.problem_id can be joined with Problems.problem_id
# Problem_Log.assigned_to_staff_id can be joined with Staff.staff_id
# Problem_Log.problem_category_code can be joined with Problem_Category_Codes.problem_category_code
# Problems.reported_by_staff_id can be joined with Staff.staff_id
# Problems.product_id can be joined with Product.product_id
# Problems.closure_authorised_by_staff_id can be joined with Staff.staff_id
#
### Question:
#
# What are the ids of the problems which are reported before 1978-06-26?
#
### SQL:
#
# SELECT problem_id FROM problems WHERE date_problem_reported < "1978-06-26"
#
### End.
|
tracking_software_problems
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Problem_Category_Codes ( problem_category_code, problem_category_description )
# Problem_Log ( problem_log_id, assigned_to_staff_id, problem_id, problem_category_code, problem_status_code, log_entry_date, log_entry_description, log_entry_fix, other_log_details )
# Problem_Status_Codes ( problem_status_code, problem_status_description )
# Product ( product_id, product_name, product_details )
# Staff ( staff_id, staff_first_name, staff_last_name, other_staff_details )
# Problems ( problem_id, product_id, closure_authorised_by_staff_id, reported_by_staff_id, date_problem_reported, date_problem_closed, problem_description, other_problem_details )
#
# Problem_Log.problem_status_code can be joined with Problem_Status_Codes.problem_status_code
# Problem_Log.problem_id can be joined with Problems.problem_id
# Problem_Log.assigned_to_staff_id can be joined with Staff.staff_id
# Problem_Log.problem_category_code can be joined with Problem_Category_Codes.problem_category_code
# Problems.reported_by_staff_id can be joined with Staff.staff_id
# Problems.product_id can be joined with Product.product_id
# Problems.closure_authorised_by_staff_id can be joined with Staff.staff_id
#
### Question:
#
# Which problems are reported before 1978-06-26? Give me the ids of the problems.
#
### SQL:
#
# SELECT problem_id FROM problems WHERE date_problem_reported < "1978-06-26"
#
### End.
|
tracking_software_problems
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Problem_Category_Codes ( problem_category_code, problem_category_description )
# Problem_Log ( problem_log_id, assigned_to_staff_id, problem_id, problem_category_code, problem_status_code, log_entry_date, log_entry_description, log_entry_fix, other_log_details )
# Problem_Status_Codes ( problem_status_code, problem_status_description )
# Product ( product_id, product_name, product_details )
# Staff ( staff_id, staff_first_name, staff_last_name, other_staff_details )
# Problems ( problem_id, product_id, closure_authorised_by_staff_id, reported_by_staff_id, date_problem_reported, date_problem_closed, problem_description, other_problem_details )
#
# Problem_Log.problem_status_code can be joined with Problem_Status_Codes.problem_status_code
# Problem_Log.problem_id can be joined with Problems.problem_id
# Problem_Log.assigned_to_staff_id can be joined with Staff.staff_id
# Problem_Log.problem_category_code can be joined with Problem_Category_Codes.problem_category_code
# Problems.reported_by_staff_id can be joined with Staff.staff_id
# Problems.product_id can be joined with Product.product_id
# Problems.closure_authorised_by_staff_id can be joined with Staff.staff_id
#
### Question:
#
# For each product which has problems, what are the number of problems and the product id?
#
### SQL:
#
# SELECT count(*) , T2.product_id FROM problems AS T1 JOIN product AS T2 ON T1.product_id = T2.product_id GROUP BY T2.product_id
#
### End.
|
tracking_software_problems
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Problem_Category_Codes ( problem_category_code, problem_category_description )
# Problem_Log ( problem_log_id, assigned_to_staff_id, problem_id, problem_category_code, problem_status_code, log_entry_date, log_entry_description, log_entry_fix, other_log_details )
# Problem_Status_Codes ( problem_status_code, problem_status_description )
# Product ( product_id, product_name, product_details )
# Staff ( staff_id, staff_first_name, staff_last_name, other_staff_details )
# Problems ( problem_id, product_id, closure_authorised_by_staff_id, reported_by_staff_id, date_problem_reported, date_problem_closed, problem_description, other_problem_details )
#
# Problem_Log.problem_status_code can be joined with Problem_Status_Codes.problem_status_code
# Problem_Log.problem_id can be joined with Problems.problem_id
# Problem_Log.assigned_to_staff_id can be joined with Staff.staff_id
# Problem_Log.problem_category_code can be joined with Problem_Category_Codes.problem_category_code
# Problems.reported_by_staff_id can be joined with Staff.staff_id
# Problems.product_id can be joined with Product.product_id
# Problems.closure_authorised_by_staff_id can be joined with Staff.staff_id
#
### Question:
#
# For each product with some problems, list the count of problems and the product id.
#
### SQL:
#
# SELECT count(*) , T2.product_id FROM problems AS T1 JOIN product AS T2 ON T1.product_id = T2.product_id GROUP BY T2.product_id
#
### End.
|
tracking_software_problems
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Problem_Category_Codes ( problem_category_code, problem_category_description )
# Problem_Log ( problem_log_id, assigned_to_staff_id, problem_id, problem_category_code, problem_status_code, log_entry_date, log_entry_description, log_entry_fix, other_log_details )
# Problem_Status_Codes ( problem_status_code, problem_status_description )
# Product ( product_id, product_name, product_details )
# Staff ( staff_id, staff_first_name, staff_last_name, other_staff_details )
# Problems ( problem_id, product_id, closure_authorised_by_staff_id, reported_by_staff_id, date_problem_reported, date_problem_closed, problem_description, other_problem_details )
#
# Problem_Log.problem_status_code can be joined with Problem_Status_Codes.problem_status_code
# Problem_Log.problem_id can be joined with Problems.problem_id
# Problem_Log.assigned_to_staff_id can be joined with Staff.staff_id
# Problem_Log.problem_category_code can be joined with Problem_Category_Codes.problem_category_code
# Problems.reported_by_staff_id can be joined with Staff.staff_id
# Problems.product_id can be joined with Product.product_id
# Problems.closure_authorised_by_staff_id can be joined with Staff.staff_id
#
### Question:
#
# For each product that has problems, find the number of problems reported after 1986-11-13 and the product id?
#
### SQL:
#
# SELECT count(*) , T2.product_id FROM problems AS T1 JOIN product AS T2 ON T1.product_id = T2.product_id WHERE T1.date_problem_reported > "1986-11-13" GROUP BY T2.product_id
#
### End.
|
tracking_software_problems
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Problem_Category_Codes ( problem_category_code, problem_category_description )
# Problem_Log ( problem_log_id, assigned_to_staff_id, problem_id, problem_category_code, problem_status_code, log_entry_date, log_entry_description, log_entry_fix, other_log_details )
# Problem_Status_Codes ( problem_status_code, problem_status_description )
# Product ( product_id, product_name, product_details )
# Staff ( staff_id, staff_first_name, staff_last_name, other_staff_details )
# Problems ( problem_id, product_id, closure_authorised_by_staff_id, reported_by_staff_id, date_problem_reported, date_problem_closed, problem_description, other_problem_details )
#
# Problem_Log.problem_status_code can be joined with Problem_Status_Codes.problem_status_code
# Problem_Log.problem_id can be joined with Problems.problem_id
# Problem_Log.assigned_to_staff_id can be joined with Staff.staff_id
# Problem_Log.problem_category_code can be joined with Problem_Category_Codes.problem_category_code
# Problems.reported_by_staff_id can be joined with Staff.staff_id
# Problems.product_id can be joined with Product.product_id
# Problems.closure_authorised_by_staff_id can be joined with Staff.staff_id
#
### Question:
#
# What are the products that have problems reported after 1986-11-13? Give me the product id and the count of problems reported after 1986-11-13.
#
### SQL:
#
# SELECT count(*) , T2.product_id FROM problems AS T1 JOIN product AS T2 ON T1.product_id = T2.product_id WHERE T1.date_problem_reported > "1986-11-13" GROUP BY T2.product_id
#
### End.
|
tracking_software_problems
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Problem_Category_Codes ( problem_category_code, problem_category_description )
# Problem_Log ( problem_log_id, assigned_to_staff_id, problem_id, problem_category_code, problem_status_code, log_entry_date, log_entry_description, log_entry_fix, other_log_details )
# Problem_Status_Codes ( problem_status_code, problem_status_description )
# Product ( product_id, product_name, product_details )
# Staff ( staff_id, staff_first_name, staff_last_name, other_staff_details )
# Problems ( problem_id, product_id, closure_authorised_by_staff_id, reported_by_staff_id, date_problem_reported, date_problem_closed, problem_description, other_problem_details )
#
# Problem_Log.problem_status_code can be joined with Problem_Status_Codes.problem_status_code
# Problem_Log.problem_id can be joined with Problems.problem_id
# Problem_Log.assigned_to_staff_id can be joined with Staff.staff_id
# Problem_Log.problem_category_code can be joined with Problem_Category_Codes.problem_category_code
# Problems.reported_by_staff_id can be joined with Staff.staff_id
# Problems.product_id can be joined with Product.product_id
# Problems.closure_authorised_by_staff_id can be joined with Staff.staff_id
#
### Question:
#
# List the names of all the distinct product names in alphabetical order?
#
### SQL:
#
# SELECT DISTINCT product_name FROM product ORDER BY product_name
#
### End.
|
tracking_software_problems
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Problem_Category_Codes ( problem_category_code, problem_category_description )
# Problem_Log ( problem_log_id, assigned_to_staff_id, problem_id, problem_category_code, problem_status_code, log_entry_date, log_entry_description, log_entry_fix, other_log_details )
# Problem_Status_Codes ( problem_status_code, problem_status_description )
# Product ( product_id, product_name, product_details )
# Staff ( staff_id, staff_first_name, staff_last_name, other_staff_details )
# Problems ( problem_id, product_id, closure_authorised_by_staff_id, reported_by_staff_id, date_problem_reported, date_problem_closed, problem_description, other_problem_details )
#
# Problem_Log.problem_status_code can be joined with Problem_Status_Codes.problem_status_code
# Problem_Log.problem_id can be joined with Problems.problem_id
# Problem_Log.assigned_to_staff_id can be joined with Staff.staff_id
# Problem_Log.problem_category_code can be joined with Problem_Category_Codes.problem_category_code
# Problems.reported_by_staff_id can be joined with Staff.staff_id
# Problems.product_id can be joined with Product.product_id
# Problems.closure_authorised_by_staff_id can be joined with Staff.staff_id
#
### Question:
#
# Sort all the distinct product names in alphabetical order.
#
### SQL:
#
# SELECT DISTINCT product_name FROM product ORDER BY product_name
#
### End.
|
tracking_software_problems
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Problem_Category_Codes ( problem_category_code, problem_category_description )
# Problem_Log ( problem_log_id, assigned_to_staff_id, problem_id, problem_category_code, problem_status_code, log_entry_date, log_entry_description, log_entry_fix, other_log_details )
# Problem_Status_Codes ( problem_status_code, problem_status_description )
# Product ( product_id, product_name, product_details )
# Staff ( staff_id, staff_first_name, staff_last_name, other_staff_details )
# Problems ( problem_id, product_id, closure_authorised_by_staff_id, reported_by_staff_id, date_problem_reported, date_problem_closed, problem_description, other_problem_details )
#
# Problem_Log.problem_status_code can be joined with Problem_Status_Codes.problem_status_code
# Problem_Log.problem_id can be joined with Problems.problem_id
# Problem_Log.assigned_to_staff_id can be joined with Staff.staff_id
# Problem_Log.problem_category_code can be joined with Problem_Category_Codes.problem_category_code
# Problems.reported_by_staff_id can be joined with Staff.staff_id
# Problems.product_id can be joined with Product.product_id
# Problems.closure_authorised_by_staff_id can be joined with Staff.staff_id
#
### Question:
#
# List all the distinct product names ordered by product id?
#
### SQL:
#
# SELECT DISTINCT product_name FROM product ORDER BY product_id
#
### End.
|
tracking_software_problems
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Problem_Category_Codes ( problem_category_code, problem_category_description )
# Problem_Log ( problem_log_id, assigned_to_staff_id, problem_id, problem_category_code, problem_status_code, log_entry_date, log_entry_description, log_entry_fix, other_log_details )
# Problem_Status_Codes ( problem_status_code, problem_status_description )
# Product ( product_id, product_name, product_details )
# Staff ( staff_id, staff_first_name, staff_last_name, other_staff_details )
# Problems ( problem_id, product_id, closure_authorised_by_staff_id, reported_by_staff_id, date_problem_reported, date_problem_closed, problem_description, other_problem_details )
#
# Problem_Log.problem_status_code can be joined with Problem_Status_Codes.problem_status_code
# Problem_Log.problem_id can be joined with Problems.problem_id
# Problem_Log.assigned_to_staff_id can be joined with Staff.staff_id
# Problem_Log.problem_category_code can be joined with Problem_Category_Codes.problem_category_code
# Problems.reported_by_staff_id can be joined with Staff.staff_id
# Problems.product_id can be joined with Product.product_id
# Problems.closure_authorised_by_staff_id can be joined with Staff.staff_id
#
### Question:
#
# What is the list of distinct product names sorted by product id?
#
### SQL:
#
# SELECT DISTINCT product_name FROM product ORDER BY product_id
#
### End.
|
tracking_software_problems
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Problem_Category_Codes ( problem_category_code, problem_category_description )
# Problem_Log ( problem_log_id, assigned_to_staff_id, problem_id, problem_category_code, problem_status_code, log_entry_date, log_entry_description, log_entry_fix, other_log_details )
# Problem_Status_Codes ( problem_status_code, problem_status_description )
# Product ( product_id, product_name, product_details )
# Staff ( staff_id, staff_first_name, staff_last_name, other_staff_details )
# Problems ( problem_id, product_id, closure_authorised_by_staff_id, reported_by_staff_id, date_problem_reported, date_problem_closed, problem_description, other_problem_details )
#
# Problem_Log.problem_status_code can be joined with Problem_Status_Codes.problem_status_code
# Problem_Log.problem_id can be joined with Problems.problem_id
# Problem_Log.assigned_to_staff_id can be joined with Staff.staff_id
# Problem_Log.problem_category_code can be joined with Problem_Category_Codes.problem_category_code
# Problems.reported_by_staff_id can be joined with Staff.staff_id
# Problems.product_id can be joined with Product.product_id
# Problems.closure_authorised_by_staff_id can be joined with Staff.staff_id
#
### Question:
#
# What are the id of problems reported by the staff named Dameon Frami or Jolie Weber?
#
### SQL:
#
# SELECT product_id FROM problems AS T1 JOIN staff AS T2 ON T1.reported_by_staff_id = T2.staff_id WHERE T2.staff_first_name = "Dameon" AND T2.staff_last_name = "Frami" UNION SELECT product_id FROM problems AS T1 JOIN staff AS T2 ON T1.reported_by_staff_id = T2.staff_id WHERE T2.staff_first_name = "Jolie" AND T2.staff_last_name = "Weber"
#
### End.
|
tracking_software_problems
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Problem_Category_Codes ( problem_category_code, problem_category_description )
# Problem_Log ( problem_log_id, assigned_to_staff_id, problem_id, problem_category_code, problem_status_code, log_entry_date, log_entry_description, log_entry_fix, other_log_details )
# Problem_Status_Codes ( problem_status_code, problem_status_description )
# Product ( product_id, product_name, product_details )
# Staff ( staff_id, staff_first_name, staff_last_name, other_staff_details )
# Problems ( problem_id, product_id, closure_authorised_by_staff_id, reported_by_staff_id, date_problem_reported, date_problem_closed, problem_description, other_problem_details )
#
# Problem_Log.problem_status_code can be joined with Problem_Status_Codes.problem_status_code
# Problem_Log.problem_id can be joined with Problems.problem_id
# Problem_Log.assigned_to_staff_id can be joined with Staff.staff_id
# Problem_Log.problem_category_code can be joined with Problem_Category_Codes.problem_category_code
# Problems.reported_by_staff_id can be joined with Staff.staff_id
# Problems.product_id can be joined with Product.product_id
# Problems.closure_authorised_by_staff_id can be joined with Staff.staff_id
#
### Question:
#
# Which problems were reported by the staff named Dameon Frami or Jolie Weber? Give me the ids of the problems.
#
### SQL:
#
# SELECT product_id FROM problems AS T1 JOIN staff AS T2 ON T1.reported_by_staff_id = T2.staff_id WHERE T2.staff_first_name = "Dameon" AND T2.staff_last_name = "Frami" UNION SELECT product_id FROM problems AS T1 JOIN staff AS T2 ON T1.reported_by_staff_id = T2.staff_id WHERE T2.staff_first_name = "Jolie" AND T2.staff_last_name = "Weber"
#
### End.
|
tracking_software_problems
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Problem_Category_Codes ( problem_category_code, problem_category_description )
# Problem_Log ( problem_log_id, assigned_to_staff_id, problem_id, problem_category_code, problem_status_code, log_entry_date, log_entry_description, log_entry_fix, other_log_details )
# Problem_Status_Codes ( problem_status_code, problem_status_description )
# Product ( product_id, product_name, product_details )
# Staff ( staff_id, staff_first_name, staff_last_name, other_staff_details )
# Problems ( problem_id, product_id, closure_authorised_by_staff_id, reported_by_staff_id, date_problem_reported, date_problem_closed, problem_description, other_problem_details )
#
# Problem_Log.problem_status_code can be joined with Problem_Status_Codes.problem_status_code
# Problem_Log.problem_id can be joined with Problems.problem_id
# Problem_Log.assigned_to_staff_id can be joined with Staff.staff_id
# Problem_Log.problem_category_code can be joined with Problem_Category_Codes.problem_category_code
# Problems.reported_by_staff_id can be joined with Staff.staff_id
# Problems.product_id can be joined with Product.product_id
# Problems.closure_authorised_by_staff_id can be joined with Staff.staff_id
#
### Question:
#
# What are the product ids for the problems reported by Christop Berge with closure authorised by Ashley Medhurst?
#
### SQL:
#
# SELECT product_id FROM problems AS T1 JOIN staff AS T2 ON T1.reported_by_staff_id = T2.staff_id WHERE T2.staff_first_name = "Christop" AND T2.staff_last_name = "Berge" INTERSECT SELECT product_id FROM problems AS T1 JOIN staff AS T2 ON T1.closure_authorised_by_staff_id = T2.staff_id WHERE T2.staff_first_name = "Ashley" AND T2.staff_last_name = "Medhurst"
#
### End.
|
tracking_software_problems
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Problem_Category_Codes ( problem_category_code, problem_category_description )
# Problem_Log ( problem_log_id, assigned_to_staff_id, problem_id, problem_category_code, problem_status_code, log_entry_date, log_entry_description, log_entry_fix, other_log_details )
# Problem_Status_Codes ( problem_status_code, problem_status_description )
# Product ( product_id, product_name, product_details )
# Staff ( staff_id, staff_first_name, staff_last_name, other_staff_details )
# Problems ( problem_id, product_id, closure_authorised_by_staff_id, reported_by_staff_id, date_problem_reported, date_problem_closed, problem_description, other_problem_details )
#
# Problem_Log.problem_status_code can be joined with Problem_Status_Codes.problem_status_code
# Problem_Log.problem_id can be joined with Problems.problem_id
# Problem_Log.assigned_to_staff_id can be joined with Staff.staff_id
# Problem_Log.problem_category_code can be joined with Problem_Category_Codes.problem_category_code
# Problems.reported_by_staff_id can be joined with Staff.staff_id
# Problems.product_id can be joined with Product.product_id
# Problems.closure_authorised_by_staff_id can be joined with Staff.staff_id
#
### Question:
#
# For which product was there a problem reported by Christop Berge, with closure authorised by Ashley Medhurst? Return the product ids.
#
### SQL:
#
# SELECT product_id FROM problems AS T1 JOIN staff AS T2 ON T1.reported_by_staff_id = T2.staff_id WHERE T2.staff_first_name = "Christop" AND T2.staff_last_name = "Berge" INTERSECT SELECT product_id FROM problems AS T1 JOIN staff AS T2 ON T1.closure_authorised_by_staff_id = T2.staff_id WHERE T2.staff_first_name = "Ashley" AND T2.staff_last_name = "Medhurst"
#
### End.
|
tracking_software_problems
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Problem_Category_Codes ( problem_category_code, problem_category_description )
# Problem_Log ( problem_log_id, assigned_to_staff_id, problem_id, problem_category_code, problem_status_code, log_entry_date, log_entry_description, log_entry_fix, other_log_details )
# Problem_Status_Codes ( problem_status_code, problem_status_description )
# Product ( product_id, product_name, product_details )
# Staff ( staff_id, staff_first_name, staff_last_name, other_staff_details )
# Problems ( problem_id, product_id, closure_authorised_by_staff_id, reported_by_staff_id, date_problem_reported, date_problem_closed, problem_description, other_problem_details )
#
# Problem_Log.problem_status_code can be joined with Problem_Status_Codes.problem_status_code
# Problem_Log.problem_id can be joined with Problems.problem_id
# Problem_Log.assigned_to_staff_id can be joined with Staff.staff_id
# Problem_Log.problem_category_code can be joined with Problem_Category_Codes.problem_category_code
# Problems.reported_by_staff_id can be joined with Staff.staff_id
# Problems.product_id can be joined with Product.product_id
# Problems.closure_authorised_by_staff_id can be joined with Staff.staff_id
#
### Question:
#
# What are the ids of the problems reported before the date of any problem reported by Lysanne Turcotte?
#
### SQL:
#
# SELECT T1.problem_id FROM problems AS T1 JOIN staff AS T2 ON T1.reported_by_staff_id = T2.staff_id WHERE date_problem_reported < ( SELECT min(date_problem_reported) FROM problems AS T3 JOIN staff AS T4 ON T3.reported_by_staff_id = T4.staff_id WHERE T4.staff_first_name = "Lysanne" AND T4.staff_last_name = "Turcotte" )
#
### End.
|
tracking_software_problems
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Problem_Category_Codes ( problem_category_code, problem_category_description )
# Problem_Log ( problem_log_id, assigned_to_staff_id, problem_id, problem_category_code, problem_status_code, log_entry_date, log_entry_description, log_entry_fix, other_log_details )
# Problem_Status_Codes ( problem_status_code, problem_status_description )
# Product ( product_id, product_name, product_details )
# Staff ( staff_id, staff_first_name, staff_last_name, other_staff_details )
# Problems ( problem_id, product_id, closure_authorised_by_staff_id, reported_by_staff_id, date_problem_reported, date_problem_closed, problem_description, other_problem_details )
#
# Problem_Log.problem_status_code can be joined with Problem_Status_Codes.problem_status_code
# Problem_Log.problem_id can be joined with Problems.problem_id
# Problem_Log.assigned_to_staff_id can be joined with Staff.staff_id
# Problem_Log.problem_category_code can be joined with Problem_Category_Codes.problem_category_code
# Problems.reported_by_staff_id can be joined with Staff.staff_id
# Problems.product_id can be joined with Product.product_id
# Problems.closure_authorised_by_staff_id can be joined with Staff.staff_id
#
### Question:
#
# Which problems were reported before the date of any problem reported by the staff Lysanne Turcotte? Give me the ids of the problems.
#
### SQL:
#
# SELECT T1.problem_id FROM problems AS T1 JOIN staff AS T2 ON T1.reported_by_staff_id = T2.staff_id WHERE date_problem_reported < ( SELECT min(date_problem_reported) FROM problems AS T3 JOIN staff AS T4 ON T3.reported_by_staff_id = T4.staff_id WHERE T4.staff_first_name = "Lysanne" AND T4.staff_last_name = "Turcotte" )
#
### End.
|
tracking_software_problems
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Problem_Category_Codes ( problem_category_code, problem_category_description )
# Problem_Log ( problem_log_id, assigned_to_staff_id, problem_id, problem_category_code, problem_status_code, log_entry_date, log_entry_description, log_entry_fix, other_log_details )
# Problem_Status_Codes ( problem_status_code, problem_status_description )
# Product ( product_id, product_name, product_details )
# Staff ( staff_id, staff_first_name, staff_last_name, other_staff_details )
# Problems ( problem_id, product_id, closure_authorised_by_staff_id, reported_by_staff_id, date_problem_reported, date_problem_closed, problem_description, other_problem_details )
#
# Problem_Log.problem_status_code can be joined with Problem_Status_Codes.problem_status_code
# Problem_Log.problem_id can be joined with Problems.problem_id
# Problem_Log.assigned_to_staff_id can be joined with Staff.staff_id
# Problem_Log.problem_category_code can be joined with Problem_Category_Codes.problem_category_code
# Problems.reported_by_staff_id can be joined with Staff.staff_id
# Problems.product_id can be joined with Product.product_id
# Problems.closure_authorised_by_staff_id can be joined with Staff.staff_id
#
### Question:
#
# What are the ids of the problems reported after the date of any problems reported by Rylan Homenick?
#
### SQL:
#
# SELECT T1.problem_id FROM problems AS T1 JOIN staff AS T2 ON T1.reported_by_staff_id = T2.staff_id WHERE date_problem_reported > ( SELECT max(date_problem_reported) FROM problems AS T3 JOIN staff AS T4 ON T3.reported_by_staff_id = T4.staff_id WHERE T4.staff_first_name = "Rylan" AND T4.staff_last_name = "Homenick" )
#
### End.
|
tracking_software_problems
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Problem_Category_Codes ( problem_category_code, problem_category_description )
# Problem_Log ( problem_log_id, assigned_to_staff_id, problem_id, problem_category_code, problem_status_code, log_entry_date, log_entry_description, log_entry_fix, other_log_details )
# Problem_Status_Codes ( problem_status_code, problem_status_description )
# Product ( product_id, product_name, product_details )
# Staff ( staff_id, staff_first_name, staff_last_name, other_staff_details )
# Problems ( problem_id, product_id, closure_authorised_by_staff_id, reported_by_staff_id, date_problem_reported, date_problem_closed, problem_description, other_problem_details )
#
# Problem_Log.problem_status_code can be joined with Problem_Status_Codes.problem_status_code
# Problem_Log.problem_id can be joined with Problems.problem_id
# Problem_Log.assigned_to_staff_id can be joined with Staff.staff_id
# Problem_Log.problem_category_code can be joined with Problem_Category_Codes.problem_category_code
# Problems.reported_by_staff_id can be joined with Staff.staff_id
# Problems.product_id can be joined with Product.product_id
# Problems.closure_authorised_by_staff_id can be joined with Staff.staff_id
#
### Question:
#
# Find the ids of the problems reported after the date of any problems reported by the staff Rylan Homenick.
#
### SQL:
#
# SELECT T1.problem_id FROM problems AS T1 JOIN staff AS T2 ON T1.reported_by_staff_id = T2.staff_id WHERE date_problem_reported > ( SELECT max(date_problem_reported) FROM problems AS T3 JOIN staff AS T4 ON T3.reported_by_staff_id = T4.staff_id WHERE T4.staff_first_name = "Rylan" AND T4.staff_last_name = "Homenick" )
#
### End.
|
tracking_software_problems
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Problem_Category_Codes ( problem_category_code, problem_category_description )
# Problem_Log ( problem_log_id, assigned_to_staff_id, problem_id, problem_category_code, problem_status_code, log_entry_date, log_entry_description, log_entry_fix, other_log_details )
# Problem_Status_Codes ( problem_status_code, problem_status_description )
# Product ( product_id, product_name, product_details )
# Staff ( staff_id, staff_first_name, staff_last_name, other_staff_details )
# Problems ( problem_id, product_id, closure_authorised_by_staff_id, reported_by_staff_id, date_problem_reported, date_problem_closed, problem_description, other_problem_details )
#
# Problem_Log.problem_status_code can be joined with Problem_Status_Codes.problem_status_code
# Problem_Log.problem_id can be joined with Problems.problem_id
# Problem_Log.assigned_to_staff_id can be joined with Staff.staff_id
# Problem_Log.problem_category_code can be joined with Problem_Category_Codes.problem_category_code
# Problems.reported_by_staff_id can be joined with Staff.staff_id
# Problems.product_id can be joined with Product.product_id
# Problems.closure_authorised_by_staff_id can be joined with Staff.staff_id
#
### Question:
#
# Find the top 3 products which have the largest number of problems?
#
### SQL:
#
# SELECT T2.product_name FROM problems AS T1 JOIN product AS T2 ON T1.product_id = T2.product_id GROUP BY T2.product_name ORDER BY count(*) DESC LIMIT 3
#
### End.
|
tracking_software_problems
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Problem_Category_Codes ( problem_category_code, problem_category_description )
# Problem_Log ( problem_log_id, assigned_to_staff_id, problem_id, problem_category_code, problem_status_code, log_entry_date, log_entry_description, log_entry_fix, other_log_details )
# Problem_Status_Codes ( problem_status_code, problem_status_description )
# Product ( product_id, product_name, product_details )
# Staff ( staff_id, staff_first_name, staff_last_name, other_staff_details )
# Problems ( problem_id, product_id, closure_authorised_by_staff_id, reported_by_staff_id, date_problem_reported, date_problem_closed, problem_description, other_problem_details )
#
# Problem_Log.problem_status_code can be joined with Problem_Status_Codes.problem_status_code
# Problem_Log.problem_id can be joined with Problems.problem_id
# Problem_Log.assigned_to_staff_id can be joined with Staff.staff_id
# Problem_Log.problem_category_code can be joined with Problem_Category_Codes.problem_category_code
# Problems.reported_by_staff_id can be joined with Staff.staff_id
# Problems.product_id can be joined with Product.product_id
# Problems.closure_authorised_by_staff_id can be joined with Staff.staff_id
#
### Question:
#
# What are the three products that have the most problems?s
#
### SQL:
#
# SELECT T2.product_name FROM problems AS T1 JOIN product AS T2 ON T1.product_id = T2.product_id GROUP BY T2.product_name ORDER BY count(*) DESC LIMIT 3
#
### End.
|
tracking_software_problems
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Problem_Category_Codes ( problem_category_code, problem_category_description )
# Problem_Log ( problem_log_id, assigned_to_staff_id, problem_id, problem_category_code, problem_status_code, log_entry_date, log_entry_description, log_entry_fix, other_log_details )
# Problem_Status_Codes ( problem_status_code, problem_status_description )
# Product ( product_id, product_name, product_details )
# Staff ( staff_id, staff_first_name, staff_last_name, other_staff_details )
# Problems ( problem_id, product_id, closure_authorised_by_staff_id, reported_by_staff_id, date_problem_reported, date_problem_closed, problem_description, other_problem_details )
#
# Problem_Log.problem_status_code can be joined with Problem_Status_Codes.problem_status_code
# Problem_Log.problem_id can be joined with Problems.problem_id
# Problem_Log.assigned_to_staff_id can be joined with Staff.staff_id
# Problem_Log.problem_category_code can be joined with Problem_Category_Codes.problem_category_code
# Problems.reported_by_staff_id can be joined with Staff.staff_id
# Problems.product_id can be joined with Product.product_id
# Problems.closure_authorised_by_staff_id can be joined with Staff.staff_id
#
### Question:
#
# List the ids of the problems from the product "voluptatem" that are reported after 1995?
#
### SQL:
#
# SELECT T1.problem_id FROM problems AS T1 JOIN product AS T2 ON T1.product_id = T2.product_id WHERE T2.product_name = "voluptatem" AND T1.date_problem_reported > "1995"
#
### End.
|
tracking_software_problems
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Problem_Category_Codes ( problem_category_code, problem_category_description )
# Problem_Log ( problem_log_id, assigned_to_staff_id, problem_id, problem_category_code, problem_status_code, log_entry_date, log_entry_description, log_entry_fix, other_log_details )
# Problem_Status_Codes ( problem_status_code, problem_status_description )
# Product ( product_id, product_name, product_details )
# Staff ( staff_id, staff_first_name, staff_last_name, other_staff_details )
# Problems ( problem_id, product_id, closure_authorised_by_staff_id, reported_by_staff_id, date_problem_reported, date_problem_closed, problem_description, other_problem_details )
#
# Problem_Log.problem_status_code can be joined with Problem_Status_Codes.problem_status_code
# Problem_Log.problem_id can be joined with Problems.problem_id
# Problem_Log.assigned_to_staff_id can be joined with Staff.staff_id
# Problem_Log.problem_category_code can be joined with Problem_Category_Codes.problem_category_code
# Problems.reported_by_staff_id can be joined with Staff.staff_id
# Problems.product_id can be joined with Product.product_id
# Problems.closure_authorised_by_staff_id can be joined with Staff.staff_id
#
### Question:
#
# What are the ids of the problems that are from the product "voluptatem" and are reported after 1995?
#
### SQL:
#
# SELECT T1.problem_id FROM problems AS T1 JOIN product AS T2 ON T1.product_id = T2.product_id WHERE T2.product_name = "voluptatem" AND T1.date_problem_reported > "1995"
#
### End.
|
tracking_software_problems
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Problem_Category_Codes ( problem_category_code, problem_category_description )
# Problem_Log ( problem_log_id, assigned_to_staff_id, problem_id, problem_category_code, problem_status_code, log_entry_date, log_entry_description, log_entry_fix, other_log_details )
# Problem_Status_Codes ( problem_status_code, problem_status_description )
# Product ( product_id, product_name, product_details )
# Staff ( staff_id, staff_first_name, staff_last_name, other_staff_details )
# Problems ( problem_id, product_id, closure_authorised_by_staff_id, reported_by_staff_id, date_problem_reported, date_problem_closed, problem_description, other_problem_details )
#
# Problem_Log.problem_status_code can be joined with Problem_Status_Codes.problem_status_code
# Problem_Log.problem_id can be joined with Problems.problem_id
# Problem_Log.assigned_to_staff_id can be joined with Staff.staff_id
# Problem_Log.problem_category_code can be joined with Problem_Category_Codes.problem_category_code
# Problems.reported_by_staff_id can be joined with Staff.staff_id
# Problems.product_id can be joined with Product.product_id
# Problems.closure_authorised_by_staff_id can be joined with Staff.staff_id
#
### Question:
#
# Find the first and last name of the staff members who reported problems from the product "rem" but not "aut"?
#
### SQL:
#
# SELECT T3.staff_first_name , T3.staff_last_name FROM problems AS T1 JOIN product AS T2 JOIN staff AS T3 ON T1.product_id = T2.product_id AND T1.reported_by_staff_id = T3.staff_id WHERE T2.product_name = "rem" EXCEPT SELECT T3.staff_first_name , T3.staff_last_name FROM problems AS T1 JOIN product AS T2 JOIN staff AS T3 ON T1.product_id = T2.product_id AND T1.reported_by_staff_id = T3.staff_id WHERE T2.product_name = "aut"
#
### End.
|
tracking_software_problems
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Problem_Category_Codes ( problem_category_code, problem_category_description )
# Problem_Log ( problem_log_id, assigned_to_staff_id, problem_id, problem_category_code, problem_status_code, log_entry_date, log_entry_description, log_entry_fix, other_log_details )
# Problem_Status_Codes ( problem_status_code, problem_status_description )
# Product ( product_id, product_name, product_details )
# Staff ( staff_id, staff_first_name, staff_last_name, other_staff_details )
# Problems ( problem_id, product_id, closure_authorised_by_staff_id, reported_by_staff_id, date_problem_reported, date_problem_closed, problem_description, other_problem_details )
#
# Problem_Log.problem_status_code can be joined with Problem_Status_Codes.problem_status_code
# Problem_Log.problem_id can be joined with Problems.problem_id
# Problem_Log.assigned_to_staff_id can be joined with Staff.staff_id
# Problem_Log.problem_category_code can be joined with Problem_Category_Codes.problem_category_code
# Problems.reported_by_staff_id can be joined with Staff.staff_id
# Problems.product_id can be joined with Product.product_id
# Problems.closure_authorised_by_staff_id can be joined with Staff.staff_id
#
### Question:
#
# Which staff members who reported problems from the product "rem" but not "aut"? Give me their first and last names.
#
### SQL:
#
# SELECT T3.staff_first_name , T3.staff_last_name FROM problems AS T1 JOIN product AS T2 JOIN staff AS T3 ON T1.product_id = T2.product_id AND T1.reported_by_staff_id = T3.staff_id WHERE T2.product_name = "rem" EXCEPT SELECT T3.staff_first_name , T3.staff_last_name FROM problems AS T1 JOIN product AS T2 JOIN staff AS T3 ON T1.product_id = T2.product_id AND T1.reported_by_staff_id = T3.staff_id WHERE T2.product_name = "aut"
#
### End.
|
tracking_software_problems
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Problem_Category_Codes ( problem_category_code, problem_category_description )
# Problem_Log ( problem_log_id, assigned_to_staff_id, problem_id, problem_category_code, problem_status_code, log_entry_date, log_entry_description, log_entry_fix, other_log_details )
# Problem_Status_Codes ( problem_status_code, problem_status_description )
# Product ( product_id, product_name, product_details )
# Staff ( staff_id, staff_first_name, staff_last_name, other_staff_details )
# Problems ( problem_id, product_id, closure_authorised_by_staff_id, reported_by_staff_id, date_problem_reported, date_problem_closed, problem_description, other_problem_details )
#
# Problem_Log.problem_status_code can be joined with Problem_Status_Codes.problem_status_code
# Problem_Log.problem_id can be joined with Problems.problem_id
# Problem_Log.assigned_to_staff_id can be joined with Staff.staff_id
# Problem_Log.problem_category_code can be joined with Problem_Category_Codes.problem_category_code
# Problems.reported_by_staff_id can be joined with Staff.staff_id
# Problems.product_id can be joined with Product.product_id
# Problems.closure_authorised_by_staff_id can be joined with Staff.staff_id
#
### Question:
#
# Find the products which have problems reported by both Lacey Bosco and Kenton Champlin?
#
### SQL:
#
# SELECT T2.product_name FROM problems AS T1 JOIN product AS T2 JOIN staff AS T3 ON T1.product_id = T2.product_id AND T1.reported_by_staff_id = T3.staff_id WHERE T3.staff_first_name = "Lacey" AND T3.staff_last_name = "Bosco" INTERSECT SELECT T2.product_name FROM problems AS T1 JOIN product AS T2 JOIN staff AS T3 ON T1.product_id = T2.product_id AND T1.reported_by_staff_id = T3.staff_id WHERE T3.staff_first_name = "Kenton" AND T3.staff_last_name = "Champlin"
#
### End.
|
tracking_software_problems
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Problem_Category_Codes ( problem_category_code, problem_category_description )
# Problem_Log ( problem_log_id, assigned_to_staff_id, problem_id, problem_category_code, problem_status_code, log_entry_date, log_entry_description, log_entry_fix, other_log_details )
# Problem_Status_Codes ( problem_status_code, problem_status_description )
# Product ( product_id, product_name, product_details )
# Staff ( staff_id, staff_first_name, staff_last_name, other_staff_details )
# Problems ( problem_id, product_id, closure_authorised_by_staff_id, reported_by_staff_id, date_problem_reported, date_problem_closed, problem_description, other_problem_details )
#
# Problem_Log.problem_status_code can be joined with Problem_Status_Codes.problem_status_code
# Problem_Log.problem_id can be joined with Problems.problem_id
# Problem_Log.assigned_to_staff_id can be joined with Staff.staff_id
# Problem_Log.problem_category_code can be joined with Problem_Category_Codes.problem_category_code
# Problems.reported_by_staff_id can be joined with Staff.staff_id
# Problems.product_id can be joined with Product.product_id
# Problems.closure_authorised_by_staff_id can be joined with Staff.staff_id
#
### Question:
#
# Which products have problems reported by both the staff named Lacey Bosco and the staff named Kenton Champlin?
#
### SQL:
#
# SELECT T2.product_name FROM problems AS T1 JOIN product AS T2 JOIN staff AS T3 ON T1.product_id = T2.product_id AND T1.reported_by_staff_id = T3.staff_id WHERE T3.staff_first_name = "Lacey" AND T3.staff_last_name = "Bosco" INTERSECT SELECT T2.product_name FROM problems AS T1 JOIN product AS T2 JOIN staff AS T3 ON T1.product_id = T2.product_id AND T1.reported_by_staff_id = T3.staff_id WHERE T3.staff_first_name = "Kenton" AND T3.staff_last_name = "Champlin"
#
### End.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.