User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Database Design section within the Web Development category of DaniWeb, a massive community of 427,165 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 1,993 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Database Design advertiser: Programming Forums
Views: 2121 | Replies: 1
Reply
Join Date: Oct 2004
Posts: 15
Reputation: Dounia is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 0
Dounia Dounia is offline Offline
Newbie Poster

News Urgent help needed

  #1  
Jan 15th, 2005
: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
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Mar 2004
Posts: 732
Reputation: Phaelax is on a distinguished road 
Rep Power: 6
Solved Threads: 31
Phaelax Phaelax is offline Offline
Master Poster

Re: Urgent help needed

  #2  
Mar 29th, 2005
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.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb Database Design Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the Database Design Forum

All times are GMT -4. The time now is 8:44 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC