I have a table with the following four columns.
Student_Id
Course_Id
Seq_No
Date_Taken
Looking for any help on SQL for oracle db to get the following report.
Also is it possible to get the report in a single query using sub queries?
Course_ID | CR150
=============================================
Total students Taken | 5
Students Taken this as First Course | 3
Only Course Taken by Students | 3
Students Taken 2 Courses | 2
You need to do a nested query. The inner query should use an analytic query to select by student and course, how many courses the student is taking, and which course this is in sequence. Then you can use that in the FROM of a group by query that gives the report that you want.
I could give you the SQL but won’t because it is your homework problem, not mine. But http://www.orafaq.com/node/55 may help you learn how to do analytic queries.