Database: tracking_software_problems

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

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

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

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"

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"

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

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"

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"

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

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

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"