954,580 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Urgent help needed

:rolleyes:

Hi,
I am new to PLSQL and I have to answer three questions to which I tried my best but i could not do it any more please help.
Here are the tables and the data:
TABLE FACULTY_P( faculty_id, fac_name, office, salary);
TABLE STUDENT_P( student_id, std_name, home_phone, total_credits, gpa, advisor_id );
TABLE COURSE_P( course#, credit_hours, location, faculty_id);
TABLE ENROLLMENT_P(student_id, course#, grade);
Here is the first question:
Give the student name and the gpa for the student with the highest gpa than all colleagues with the same total credit hours,
I wrote the following: select std_name, gpa
from student_p s, course_p c1, course_p c2
where c1.credit_hours = c2. credit_hours
having max(gpa);
I wrote several statement none of them worked.
Second Question:
For each student name the list course numbers that the student obtained the lowest grade
Iwrote the following: select course# from Enrollment_p e1, Enrollment_p e2 where e1.course# = e2.course# and e1.grade < e2.grade;
Statement not working either.
Third question: Give the names of faculty who do not advise any students.
I wrote: select fac_name from faculty_p f, student_p s where
f.faculty_id <> s.advisor_id;
Not working either.
Please i need your help it is urgent that i solve this before tuesday.
Thank you for your help
Dounia

Dounia
Newbie Poster
15 posts since Oct 2004
Reputation Points: 11
Solved Threads: 0
 

I think you're making things too hard for yourself.

select std_name, gpa
from student_p
where total_credits = max(totale_credits);


student_p has the "total_credits" field in it, so you don't even need to calculate the credit total yourself by searching through course_p.(which you'd need to use enrollment_p as well)

Hopefully the code above will help you with the second question. You should not have to state the same table name twice in a FROM clause.

Phaelax
Practically a Posting Shark
858 posts since Mar 2004
Reputation Points: 92
Solved Threads: 51
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You