Home » SQL & PL/SQL » SQL & PL/SQL » Oracle 9i Guidance
Oracle 9i Guidance [message #6953] Tue, 13 May 2003 11:06 Go to next message
Nazma Bepat
Messages: 34
Registered: May 2003
Member
CAn someone please help me out. I am having a really hard time to figure ou this one.

I have to write a query to display the student id, number of courses and the average actual grade for all courses by that student using the “Grade Table. Create an alias for each column. Round the average actual grades to two decimal places.

Any guidance would be greatly appreciated.
Thanks

Nazma
Re: Oracle 9i Guidance [message #6965 is a reply to message #6953] Wed, 14 May 2003 00:37 Go to previous message
Maaher
Messages: 7065
Registered: December 2001
Senior Member
Hello again, in one of your previous posts, Barbara Boehmer has asked you to give table descriptions in your posts. Again, you failed to do so. without the proper details we can only guess what might be the proper answer. In this case, I assume the table looks like this:
GRADE_TABLE
-----------
STUDENT_ID NUMBER
COURSE_ID  NUMBER
GRADE      NUMBER
....

Anyway:
SELECT student_id          <B>student</B> -- <A HREf='http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96540/statements_103a.htm#2080329' Target=Blank>column alias</A>
     , count(course_id)    <B>courses</B>
     , <A HREF='http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96540/functions103a.htm#SQLRF00698' Target=Blank>round</A>(<A HREF='http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96540/functions11a.htm#SQLRF00609' Target=Blank>avg</A>(grade),2) <B>average</B>
  FROM grade_table
 GROUP BY student_id -- you want the results from the calculations 
                     -- grouped by student
might be correct.

MHE
Previous Topic: Trying to use NextVALUE to establish the next sequential up number to go into a mandatory column en
Next Topic: Phantom User
Goto Forum:
  


Current Time: Sat Apr 20 02:58:41 CDT 2024