Database: student_assessment

Question: which course has most number of registered students?
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

Question: what is id of students who registered some courses but the least number of courses in these students?
SQL: SELECT student_id FROM student_course_registrations GROUP BY student_id ORDER BY count(*) LIMIT 1

Question: List the id of students who never attends courses?
SQL: SELECT student_id FROM students WHERE student_id NOT IN (SELECT student_id FROM student_course_attendance)

Question: What is detail of the student who most recently registered course?
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

Question: How many students attend course English?
SQL: SELECT count(*) FROM courses AS T1 JOIN student_course_attendance AS T2 ON T1.course_id = T2.course_id WHERE T1.course_name = "English"

Question: How many courses do the student whose id is 171 attend?
SQL: SELECT count(*) FROM courses AS T1 JOIN student_course_attendance AS T2 ON T1.course_id = T2.course_id WHERE T2.student_id = 171

Question: Find id of the candidate whose email is stanley.monahan@example.org?
SQL: SELECT T2.candidate_id FROM people AS T1 JOIN candidates AS T2 ON T1.person_id = T2.candidate_id WHERE T1.email_address = "stanley.monahan@example.org"

Question: Find id of the candidate who most recently accessed the course?
SQL: SELECT candidate_id FROM candidate_assessments ORDER BY assessment_date DESC LIMIT 1

Question: What are the details of the student who registered the most number of courses?
SQL: SELECT T1.student_details FROM students AS T1 JOIN student_course_registrations AS T2 ON T1.student_id = T2.student_id GROUP BY T1.student_id ORDER BY count(*) DESC LIMIT 1

Question: List the id of students who registered some courses and the number of their registered courses?
SQL: SELECT T1.student_id ,  count(*) FROM students AS T1 JOIN student_course_registrations AS T2 ON T1.student_id = T2.student_id GROUP BY T1.student_id

Question: How many registered students does each course have? List course name and the number of their registered students.
SQL: SELECT T3.course_name ,  count(*) FROM students AS T1 JOIN student_course_registrations AS T2 ON T1.student_id = T2.student_id JOIN courses AS T3 ON T2.course_id = T3.course_id GROUP BY T2.course_id

Question: Find the cell mobile number of the candidates whose assessment code is "Fail"?
SQL: SELECT T3.cell_mobile_number FROM candidates AS T1 JOIN candidate_assessments AS T2 ON T1.candidate_id = T2.candidate_id JOIN people AS T3 ON T1.candidate_id = T3.person_id WHERE T2.asessment_outcome_code = "Fail"

Question: What is the id of the student who most recently attended course is 301?
SQL: SELECT student_id FROM student_course_attendance WHERE course_id = 301 ORDER BY date_of_attendance DESC LIMIT 1