aherntech/sparc huggingface dataset:
Database: tracking_orders
Question sequence:
Show me the names of all customers who have at least two orders.
Now show me names of customers who have at most two orders.
SQL query sequence:
SELECT T2.customer_name FROM orders AS T1 JOIN customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T2.customer_id HAVING count(*)  >=  2
SELECT T2.customer_name FROM orders AS T1 JOIN customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T2.customer_id HAVING count(*)  <=  2
Final question: Find the name of the customers who have at most two orders.
Final SQL: SELECT T2.customer_name FROM orders AS T1 JOIN customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T2.customer_id HAVING count(*)  <=  2
Database: tracking_orders
Question sequence:
List the ids of the customers who have once bought product "food".
Now list the names.
SQL query sequence:
SELECT T1.customer_id FROM customers AS T1 JOIN orders AS T2 JOIN order_items AS T3 JOIN products AS T4 ON T1.customer_id = T2.customer_id AND T2.order_id = T3.order_id AND T3.product_id = T4.product_id WHERE T4.product_name = "food" GROUP BY T1.customer_id HAVING count(*)  >=  1
SELECT T1.customer_name FROM customers AS T1 JOIN orders AS T2 JOIN order_items AS T3 JOIN products AS T4 ON T1.customer_id = T2.customer_id AND T2.order_id = T3.order_id AND T3.product_id = T4.product_id WHERE T4.product_name = "food" GROUP BY T1.customer_id HAVING count(*)  >=  1
Final question: List the names of the customers who have once bought product "food".
Final SQL: SELECT T1.customer_name FROM customers AS T1 JOIN orders AS T2 JOIN order_items AS T3 JOIN products AS T4 ON T1.customer_id = T2.customer_id AND T2.order_id = T3.order_id AND T3.product_id = T4.product_id WHERE T4.product_name = "food" GROUP BY T1.customer_id HAVING count(*)  >=  1
Database: tracking_software_problems
Question sequence:
What is the most recent log_entry_date?
the latest?
what is the product id that has this?
SQL query sequence:
SELECT log_entry_date FROM problem_log ORDER BY log_entry_date ASC LIMIT 1
SELECT log_entry_date FROM problem_log ORDER BY log_entry_date DESC LIMIT 1
SELECT problem_log_id FROM problem_log ORDER BY log_entry_date DESC LIMIT 1
Final question: What is the id of the problem log that is created most recently?
Final SQL: SELECT problem_log_id FROM problem_log ORDER BY log_entry_date DESC LIMIT 1
Database: tracking_software_problems
Question sequence:
How many problem logs are there?
Of those, what is the oldest entry date used?
Show all the problem_log information for this date!
Actually, just show the log id and problem id.
SQL query sequence:
SELECT count(*) FROM problem_log
SELECT log_entry_date FROM problem_log ORDER BY log_entry_date LIMIT 1
SELECT * FROM problem_log ORDER BY log_entry_date LIMIT 1
SELECT problem_log_id ,  problem_id FROM problem_log ORDER BY log_entry_date LIMIT 1
Final question: What is the oldest log id and its corresponding problem id?
Final SQL: SELECT problem_log_id ,  problem_id FROM problem_log ORDER BY log_entry_date LIMIT 1
Database: tracking_software_problems
Question sequence:
How many problem logs have to do with problem id 1?
Show the log ids, dates, descriptions for these.
Also show the staff for each.
Can you give me a distinct list of the names of all staff members!
SQL query sequence:
SELECT count(*) FROM problem_log where problem_id = 1
SELECT problem_log_id, log_entry_date, log_entry_description FROM problem_log where problem_id = 1
SELECT problem_log_id, log_entry_date, log_entry_description, assigned_to_staff_id FROM problem_log where problem_id = 1
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
Final question: List the first and last names of all distinct staff members who are assigned to the problem whose id is 1.
Final 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
Database: tracking_software_problems
Question sequence:
What are the problem reported by named Ryan Homenick.
How about the problems on which closure is authorized by him?
Actually can you show the different problem_logs that he is assigned to!
For these, show the distinct problem ids and log ids!
SQL query sequence:
SELECT * FROM staff AS T1 JOIN problems AS T2 ON T1.staff_id = T2.reported_by_staff_id WHERE T1.staff_first_name = "Rylan" AND T1.staff_last_name = "Homenick"
SELECT  FROM staff AS T1 JOIN problems AS T2 ON T1.staff_id = T2.closure_authorised_by_staff_id WHERE T1.staff_first_name = "Rylan" AND T1.staff_last_name = "Homenick"
SELECT * 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"
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"
Final question: List the problem id and log id which are assigned to the staff named Rylan Homenick.
Final 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"
Database: tracking_software_problems
Question sequence:
Show me all the problems on the product with name voluptatem.
What are the statuses of each?
How many are solved?
Actually how many are there in total?
SQL query sequence:
SELECT * FROM product AS T1 JOIN problems AS T2 ON T1.product_id = T2.product_id WHERE T1.product_name = "voluptatem"
SELECT *, T3.problem_status_code FROM product AS T1 JOIN problems AS T2 ON T1.product_id = T2.product_id join problem_log as T3 on T2.problem_id = T3.problem_id WHERE T1.product_name = "voluptatem"
SELECT count(*) FROM product AS T1 JOIN problems AS T2 ON T1.product_id = T2.product_id join problem_log as T3 on T2.problem_id = T3.problem_id WHERE T1.product_name = "voluptatem" and T3.problem_status_code = "Solved"
SELECT count(*) FROM product AS T1 JOIN problems AS T2 ON T1.product_id = T2.product_id WHERE T1.product_name = "voluptatem"
Final question: How many problems are there for product voluptatem?
Final SQL: SELECT count(*) FROM product AS T1 JOIN problems AS T2 ON T1.product_id = T2.product_id WHERE T1.product_name = "voluptatem"
Database: tracking_software_problems
Question sequence:
How many problems are there?
What products are they associated with?
Now show how many problems exist per product name?
Which one has the most problems?
SQL query sequence:
SELECT count(*) FROM problems
SELECT * FROM product AS T1 JOIN problems AS T2 ON T1.product_id = T2.product_id
SELECT count(*) ,  T1.product_id FROM product AS T1 JOIN problems AS T2 ON T1.product_id = T2.product_id GROUP BY T1.product_id
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
Final question: How many problems does the product with the most problems have? List the number of the problems and product name.
Final 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
Database: tracking_software_problems
Question sequence:
How many staff members have the first name Christop.
What problem are these members authorized to close!
How about what problems have these members reported!
List just the problem descriptions for each?
SQL query sequence:
SELECT count(*) FROM staff where staff_first_name = "Christop"
SELECT * FROM problems AS T1 JOIN staff AS T2 ON T1.closure_authorised_by_staff_id = T2.staff_id WHERE T2.staff_first_name = "Christop"
SELECT * FROM problems AS T1 JOIN staff AS T2 ON T1.reported_by_staff_id = T2.staff_id WHERE T2.staff_first_name = "Christop"
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"
Final question: Give me a list of descriptions of the problems that are reported by the staff whose first name is Christop.
Final 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"
Database: tracking_software_problems
Question sequence:
List all the problem ids!
What are the names of the staff members that reported each!
Show me the ids of those reported by the last name Bosco!
SQL query sequence:
SELECT problem_id FROM problems
SELECT T1.problem_id, T2.staff_first_name, T2.staff_last_name FROM problems AS T1 JOIN staff AS T2 ON T1.reported_by_staff_id = T2.staff_id
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"
Final question: Find the ids of the problems that are reported by the staff whose last name is Bosco.
Final 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"
Database: tracking_software_problems
Question sequence:
How many products do not have any problems?
What are they?
Show all the different ids of the products other than these!
Also provide the number of problems they each have!
SQL query sequence:
SELECT count(*) FROM product where product_id not in (SELECT product_id FROM problems)
SELECT product_id FROM product where product_id not in (SELECT product_id FROM problems)
SELECT distinct product_id FROM problems
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
Final question: For each product which has problems, what are the number of problems and the product id?
Final 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
Database: tracking_software_problems
Question sequence:
How many problems were reported on or before 1986-11-13?
how about after?
Show me their problem ids and product ids!
For these, show the number of problems by product id!
SQL query sequence:
SELECT count(*) FROM problems WHERE date_problem_reported <= "1986-11-13"
SELECT count(*) FROM problems WHERE date_problem_reported > "1986-11-13"
SELECT problem_id,  product_id FROM problems WHERE date_problem_reported > "1986-11-13"
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
Final question: For each product that has problems, find the number of problems reported after 1986-11-13 and the product id?
Final 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
Database: tracking_software_problems
Question sequence:
What are all the products reported by staff named Jolie Weber?
How about Dameon Fami?
Which products are reported by either one?
What are their ids?
SQL query sequence:
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"
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 = "Fami"
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"
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"
Final question: What are the id of problems reported by the staff named Dameon Frami or Jolie Weber?
Final 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"
Database: tracking_software_problems
Question sequence:
For each problem, What are the different names of staff members who can authorize closure!
Also provide the product_ids!
Show me the product ids that have closure authorized by Ashley Medhurst!
Of those, only those that were reported  by Christop Beege!
SQL query sequence:
SELECT distinct T2.staff_first_name, T2.staff_last_name FROM problems AS T1 JOIN staff AS T2 ON T1.closure_authorised_by_staff_id = T2.staff_id
SELECT product_id, T2.staff_first_name, T2.staff_last_name FROM problems AS T1 JOIN staff AS T2 ON T1.closure_authorised_by_staff_id = T2.staff_id
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"
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"
Final question: What are the product ids for the problems reported by Christop Berge with closure authorised by Ashley Medhurst?
Final 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"
Database: tracking_software_problems
Question sequence:
How many problems has staff named Lysanne Turcotte reported?
Show me their ids, and problem descriptions.
What is the oldest date these were reported?
Show me the ids of all the other problems that were reported before this date! :
SQL query sequence:
SELECT count(*) FROM problems AS T1 JOIN staff AS T2 ON T1.reported_by_staff_id = T2.staff_id WHERE T2.staff_first_name = "Lysanne" AND T2.staff_last_name = "Turcotte"
SELECT problem_id, problem_description FROM problems AS T1 JOIN staff AS T2 ON T1.reported_by_staff_id = T2.staff_id WHERE T2.staff_first_name = "Lysanne" AND T2.staff_last_name = "Turcotte"
SELECT min(date_problem_reported) FROM problems AS T1 JOIN staff AS T2 ON T1.reported_by_staff_id = T2.staff_id WHERE T2.staff_first_name = "Lysanne" AND T2.staff_last_name = "Turcotte"
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" )
Final question: What are the ids of the problems reported before the date of any problem reported by Lysanne Turcotte?
Final 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" )
Database: tracking_software_problems
Question sequence:
What are all the names of the staff members that have reported problems?
What was the problem id and date of the last problem they each reported?
Show me the date for staff named Ryan Homenick
Now show any problem id that was reported after this date!
SQL query sequence:
SELECT T2.staff_first_name, T2.staff_last_name FROM problems AS T1 JOIN staff AS T2 ON T1.reported_by_staff_id = T2.staff_id
SELECT T2.staff_first_name, T2.staff_last_name, T1.problem_id, max(date_problem_reported) FROM problems AS T1 JOIN staff AS T2 ON T1.reported_by_staff_id = T2.staff_id group by T2.staff_first_name, T2.staff_last_name
SELECT max(date_problem_reported) FROM problems AS T1 JOIN staff AS T2 ON T1.reported_by_staff_id = T2.staff_id WHERE T2.staff_first_name = "Rylan" AND T2.staff_last_name = "Homenick"
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" )
Final question: What are the ids of the problems reported after the date of any problems reported by Rylan Homenick?
Final 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" )
Database: tracking_software_problems
Question sequence:
Show me all different products with problems!
How many problems do they each have for each product name?
Show me the names of the products in the bottom 3!
What about the top 3?
SQL query sequence:
SELECT * FROM problems AS T1 JOIN product AS T2 ON T1.product_id = T2.product_id
SELECT T2.product_name, count(*) FROM problems AS T1 JOIN product AS T2 ON T1.product_id = T2.product_id GROUP BY T2.product_name
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(*) ASC LIMIT 3
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
Final question: Find the top 3 products which have the largest number of problems?
Final 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
Database: tracking_software_problems
Question sequence:
What are all the problems that are reported after 1995?
Show the product names that each are associated with?
Show the ids of the ones with the product named Rose.
How about those with the product named voluptatem
SQL query sequence:
SELECT * FROM problems where date_problem_reported > "1995"
SELECT *, T2.product_name FROM problems AS T1 JOIN product AS T2 ON T1.product_id = T2.product_id WHERE T1.date_problem_reported > "1995"
SELECT T1.problem_id FROM problems AS T1 JOIN product AS T2 ON T1.product_id = T2.product_id WHERE T2.product_name = "rose" AND T1.date_problem_reported > "1995"
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"
Final question: List the ids of the problems FROM the product "voluptatem" that are reported after 1995?
Final 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"
Database: tracking_software_problems
Question sequence:
What are first and last names of all the staff members?
Which ones reported on problems with products named "rem" or "aut"?
Of these, who reported on "rem"?
Of these, who did not report on "aut"
SQL query sequence:
SELECT staff_first_name ,  staff_last_name FROM staff
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" or T2.product_name = "aut"
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"
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"
Final question: Find the first and last name of the staff members who reported problems FROM the product "rem" but not "aut"?
Final 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"
Database: student_assessment
Question sequence:
What are the course names?
Which course has the least number of registered students?
Most number?
SQL query sequence:
SELECT course_name FROM courses
SELECT T1.course_name FROM courses AS T1 JOIN student_course_registrations AS T2 ON T1.course_id = T2.course_Id GROUP BY T1.course_id ORDER BY count(*) ASC LIMIT 1
SELECT T1.course_name FROM courses AS T1 JOIN student_course_registrations AS T2 ON T1.course_id = T2.course_Id GROUP BY T1.course_id ORDER BY count(*) DESC LIMIT 1
Final question: which course has most number of registered students?
Final SQL: SELECT T1.course_name FROM courses AS T1 JOIN student_course_registrations AS T2 ON T1.course_id = T2.course_Id GROUP BY T1.course_id ORDER BY count(*) DESC LIMIT 1
Database: student_assessment
Question sequence:
What are the course ids that students registered for?
What about student ids.
Which one registered for the least number of courses.
SQL query sequence:
SELECT course_id FROM student_course_registrations
SELECT student_id FROM student_course_registrations
SELECT student_id FROM student_course_registrations GROUP BY student_id ORDER BY count(*) LIMIT 1
Final question: what is id of students who registered some courses but the least number of courses in these students?
Final SQL: SELECT student_id FROM student_course_registrations GROUP BY student_id ORDER BY count(*) LIMIT 1
Database: student_assessment
Question sequence:
Who are the students? Give the id and details.
Which students attend courses?
Which ones do not? Just give the student id.
SQL query sequence:
SELECT student_id, student_details FROM students
SELECT student_id, student_details FROM students WHERE student_id IN (SELECT student_id FROM student_course_attendance)
SELECT student_id FROM students WHERE student_id NOT IN (SELECT student_id FROM student_course_attendance)
Final question: List the id of students who never attends courses?
Final SQL: SELECT student_id FROM students WHERE student_id NOT IN (SELECT student_id FROM student_course_attendance)
Database: student_assessment
Question sequence:
What is the course id of the most recent course registration?
Give the student id instead.
Give the student details.
SQL query sequence:
SELECT course_id FROM student_course_registrations ORDER BY registration_date DESC LIMIT 1
SELECT student_id FROM student_course_registrations ORDER BY registration_date DESC LIMIT 1
SELECT T2.student_details FROM student_course_registrations AS T1 JOIN students AS T2 ON T1.student_id = T2.student_id ORDER BY T1.registration_date DESC LIMIT 1
Final question: What is detail of the student who most recently registered course?
Final SQL: SELECT T2.student_details FROM student_course_registrations AS T1 JOIN students AS T2 ON T1.student_id = T2.student_id ORDER BY T1.registration_date DESC LIMIT 1