Database: student_assessment

Question: Find distinct cities of address of students?
SQL: SELECT DISTINCT T1.city FROM addresses AS T1 JOIN people_addresses AS T2 ON T1.address_id = T2.address_id JOIN students AS T3 ON T2.person_id = T3.student_id

Question: What are the id of students who registered courses or attended courses?
SQL: SELECT student_id FROM student_course_registrations UNION SELECT student_id FROM student_course_attendance

Question: Find the id of courses which are registered or attended by student whose id is 121?
SQL: SELECT course_id FROM student_course_registrations WHERE student_id = 121 UNION SELECT course_id FROM student_course_attendance WHERE student_id = 121

Question: What are all info of students who registered courses but not attended courses?
SQL: SELECT * FROM student_course_registrations WHERE student_id NOT IN (SELECT student_id FROM student_course_attendance)

Question: List the id of students who registered course statistics in the order of registration date.
SQL: SELECT T2.student_id FROM courses AS T1 JOIN student_course_registrations AS T2 ON T1.course_id = T2.course_id WHERE T1.course_name = "statistics" ORDER BY T2.registration_date