Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The university registrar database has the following schema: student: sid (string) course: cid (string) prerequisite: cid (string), pre_cid (string) record: sid (string), cid (string), quarter

image text in transcribedimage text in transcribed

The university registrar database has the following schema: student: sid (string) course: cid (string) prerequisite: cid (string), pre_cid (string) record: sid (string), cid (string), quarter (string), year (integer), grade (integer) Relation student provides the ids of all students enrolled in the university, and course provides all courses offered (identified by strings using letters and numbers). Relation prerequisite provides the prerequisites pre_cid for each course cid. Relation record indicates which courses were taken by each student in a given year and quarter (F, W, S), and the grade obtained (for simplicity, grades are provided as integers 4, 3, 2, 1,0, corresponding to A, B, C, D, F). Assume that a class can only be taken once. Note that students may have gaps in enrollment, i.e. they need not take courses every quarter. Also, there may be students who have not yet taken any course, and courses that have not yet been taken by any student. In addition, the following hold: sid is the primary key of student cid is the primary key of course {cid, pre_cid} is the primary key of prerequisite; cid and pre_cid are foreign keys referencing course. {sid, cid} is the primary key of record (so each student can only take a course once) grades are unique for each course taken by a student in a given year and quarter), sid is a foreign key referencing student and cid is a foreign key referencing course. 1. Find the students occurring in record who have the highest GPA. The answer should have attributes {sid, gpa}. 2. For each student who has taken at least one class, find their GPA in the most recent quarter they were enrolled. The answer should have attributes { sid, quarter, year, gpa}. Hint: It may be helpful to observe that the order of occurrence of quarters in a given calendar year is in reverse alphabetical order ('W'> 'S'> 'F'). For example, the quarters occurring in 2020 are, in chronological order, W, S and F

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Analysis Using SQL And Excel

Authors: Gordon S Linoff

2nd Edition

111902143X, 9781119021438

More Books

Students also viewed these Databases questions