•
•
•
•
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 391,777 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 3,438 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:
Views: 2072 | Replies: 1
![]() |
•
•
Join Date: Oct 2004
Posts: 15
Reputation:
Rep Power: 4
Solved Threads: 0
: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
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
•
•
Join Date: Mar 2004
Posts: 715
Reputation:
Rep Power: 6
Solved Threads: 28
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.
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.
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb Database Design Marketplace
- Urgent Advice needed (Community Introductions)
- help please urgent review needed (Website Reviews)
- java newbie (Java)
- Urgent computer help needed – I can’t see my task bar! (Windows NT / 2000 / XP / 2003)
Other Threads in the Database Design Forum
- Previous Thread: Validation rule
- Next Thread: to write a query


Linear Mode