a) Query the id number of the students who at least enrolled C2 and C4 courses. b) Query the id number, name, and age of the students who did not enroll C2 course. c) Query the names of the students who enrolled all of the courses.
Dec 19, 2017 · SELECT c.class_name "Class Name", count(distinct j.student_id) "Number of Students" FROM class c LEFT JOIN junction j ON j.class_id = c.class_id GROUP BY 1 Share Follow
Query the following in T-SQL format: Query the id number of the students who at least enrolled C2 and C4 courses. Query the id number, name, and age of the students who did not enroll C2 course. Query the names of the students who enrolled all of the courses.
Jan 25, 2015 · Here, firstly the inner query is solved. It returns all the Enrollment Numbers (SELECT S2.EnrollNo) of students where the students’ enrollment number matches with the enrollment number of the courses (WHERE S2.EnrollNo = E2.EnrollNo) which have the course IDs whose Course Name is “OS” (E2.CourseID = C2.CourseID and C2.Name = “OS”).
Given the database tables below, use your SQL skills to answer as many of the questions that follow.
There are multiple ways to write the SQL queries that answer this challenge’s questions, so they may not exactly match your own. Here are my answers to the questions. Check out the solutions Gist, if you prefer to view them there.