select STUDENTS.name, GA.noc as no_of_c, GA.gpa as gpa,
rank() over (partition by GA.noc
order by GA.gpa desc) as rank
from (select stno,
count(distinct cno) as noc,
avg(grade) as gpa
from GRADES
group by stno) GA, STUDENTS
where STUDENTS.stno = GA.stno
An example of the use of an analytic function (which we discuss in detail
in Example 5.18.2) is the following query that computes a list of students, the
number of courses they took, and their grade point average.
select STUDENTS.name, GA.noc as no_of_c, GA.gpa as gpa, rank() over (partition by GA.noc order by GA.gpa desc) as rank from (select stno, count(distinct cno) as noc, avg(grade) as gpa from GRADES group by stno) GA, STUDENTS where STUDENTS.stno = GA.stno An example of the use of an analytic function (which we discuss in detailin Example 5.18.2) is the following query that computes a list of students, thenumber of courses they took, and their grade point average.
การแปล กรุณารอสักครู่..

เลือก STUDENTS.name, GA.noc เป็น no_of_c, GA.gpa เป็นเกรดเฉลี่ย,
อันดับ () ไป (พาร์ทิชันโดย GA.noc
สั่งซื้อโดยเรียง GA.gpa) ในขณะที่การจัดอันดับ
จาก (เลือก stno,
count (ที่แตกต่าง CNO) เป็น NOC,
เฉลี่ย (เกรด) ในขณะที่เกรดเฉลี่ย
จากการเรียน
กลุ่มโดย stno) GA, นักเรียน
ที่ STUDENTS.stno = GA.stno ตัวอย่างของการใช้ฟังก์ชั่นการวิเคราะห์ (ซึ่งเราจะหารือในรายละเอียดในตัวอย่างที่ 5.18.2) จะสอบถามต่อไปนี้ที่คำนวณ รายชื่อของนักเรียน, จำนวนของพวกเขาเอาหลักสูตรและคะแนนเฉลี่ยของพวกเขา
การแปล กรุณารอสักครู่..
