Database: e_learning

Question: What are the dates of the latest logon of the students with family name "Jaskolski" or "Langosh"?
SQL: SELECT date_of_latest_logon FROM Students WHERE family_name  =  "Jaskolski" OR family_name  =  "Langosh"

Question: How many students have personal names that contain the word "son"?
SQL: SELECT COUNT(*) FROM Students WHERE personal_name LIKE "%son%"

Question: List each test result and its count in descending order of count.
SQL: SELECT test_result ,  COUNT(*) FROM Student_Tests_Taken GROUP BY test_result ORDER BY COUNT(*) DESC

Question: Find the login name of the course author that teaches the course with name "advanced database".
SQL: SELECT T1.login_name FROM Course_Authors_and_Tutors AS T1 JOIN Courses AS T2 ON T1.author_id  =  T2.author_id WHERE T2.course_name  =  "advanced database"

Question: Find the addresses of the course authors who teach the course with name "operating system" or "data structure".
SQL: SELECT T1.address_line_1 FROM Course_Authors_and_Tutors AS T1 JOIN Courses AS T2 ON T1.author_id  =  T2.author_id WHERE T2.course_name  =  "operating system" OR T2.course_name  =  "data structure"

Question: Find the personal name, family name, and author ID of the course author that teaches the most courses.
SQL: SELECT T1.personal_name ,  T1.family_name ,  T2.author_id FROM Course_Authors_and_Tutors AS T1 JOIN Courses AS T2 ON T1.author_id  =  T2.author_id GROUP BY T2.author_id ORDER BY COUNT(*) DESC LIMIT 1

Question: Find the addresses and author IDs of the course authors that teach at least two courses.
SQL: SELECT T1.address_line_1 ,  T2.author_id FROM Course_Authors_and_Tutors AS T1 JOIN Courses AS T2 ON T1.author_id  =  T2.author_id GROUP BY T2.author_id HAVING Count(*)  >=  2

Question: Find the names of courses taught by the tutor who has personal name "Julio".
SQL: SELECT T2.course_name FROM Course_Authors_and_Tutors AS T1 JOIN Courses AS T2 ON T1.author_id  =  T2.author_id WHERE T1.personal_name  =  "Julio"

Question: Find the names and descriptions of courses that belong to the subject named "Computer Science".
SQL: SELECT T1.course_name ,  T1.course_description FROM Courses AS T1 JOIN Subjects AS T2 ON T1.subject_id  =  T2.subject_id WHERE T2.subject_name  =  "Computer Science"

Question: Find the subject ID, subject name, and the corresponding number of available courses for each subject.
SQL: SELECT T1.subject_id ,  T2.subject_name ,  COUNT(*) FROM Courses AS T1 JOIN Subjects AS T2 ON T1.subject_id  =  T2.subject_id GROUP BY T1.subject_id

Question: Find the subject ID, name of subject and the corresponding number of courses for each subject, and sort by the course count in ascending order.
SQL: SELECT T1.subject_id ,  T2.subject_name ,  COUNT(*) FROM Courses AS T1 JOIN Subjects AS T2 ON T1.subject_id  =  T2.subject_id GROUP BY T1.subject_id ORDER BY COUNT(*) ASC

Question: What is the date of enrollment of the course named "Spanish"?
SQL: SELECT T2.date_of_enrolment FROM Courses AS T1 JOIN Student_Course_Enrolment AS T2 ON T1.course_id  =  T2.course_id WHERE T1.course_name  =  "Spanish"