Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Queries: Relational Algebra, Relational Calculus, and SQL Consider the following University Database schemas. Primary keys are underlined. Relational Schemas Meaning and additional information department (dcode,

Queries: Relational Algebra, Relational Calculus, and SQL Consider the following University Database schemas. Primary keys are underlined. Relational Schemas Meaning and additional information department (dcode, dname, chair) Department identified by dcode is named dname and has department chair with ssn chair (this ssn must appear in the table faculty below) course (dcode, cno, title, units) Course identified by (dcode,cno) has title and units (e.g., 3 units/credits) . (dcode must appear in the table department) prereq (dcode, cno, pcode, pno) Course (dcode, cno) has a prerequisite course (pcode, pno). Both pairs of courses must appear in the table course. class (class, dcode, cno, instr) Class identified by class id is offered by department dcode, has course number cno, and is taught by instructor with ssn instr (this ssn must appear in the table faculty below; dcode and cno pair must appear in the table course) faculty (ssn, name, dcode, rank) Faculty identified by ssn has a name and rank, and belongs to department dcode (which must appear in the table department) student (ssn, name, major, status) Student identified by ssn has a name, major and status. enrollment (class, ssn) Student identified by ssn is enrolled in the class identified by class no (ssn must appear in the table student, and class must appear in the table class) transcript (dcode, cno, ssn, grade) Student identified by ssn took the course identified by (dcode, cno) and received the grade. Assume that the only grades available are A, B, C and F. (ssn must appear in the table student; dcode and cno must appear in the table course. Implement the following queries using: A. Relational calculus, in the file ha2lib_calculus.py in the folder solution_calculus. Create initial template of ha2lib_calculus.py by duplicating ha2lib_calculus_template.py B. Relational algebra, in the file ha2lib_algebra.py in the folder solution_algebra. Create initial template of ha2lib_algebra.py by duplicating ha2lib_algebra_template.py C. SQL, in the file sql_views.sql in the folder solution_sql. Create initial template of sql_views.sql by duplicating sql_views_template.sql a. Find students (ssn, name, major, status) who have taken the course cs530 (must be in transcripts). Order the result by ssn. b. Find students (ssn, name, major, status) named John (i.e., name = "John" in student) who have taken the course CS 530 (must be in transcripts). Order the result byssn. c. Find students (ssn, name, major, status) who satisfied all prerequisites of each class they are enrolled in. Order the result byssn. d. Find students (ssn, name, major, status) who are enrolled in a class forwhich they have not satisfied all its prerequisites. To satisfy the prerequisite, the student needs to have obtained grade B or higher. Order the result byssn. e. Find students (ssn, name, major, status) named John who are enrolled in a class for which they have not satisfied all its prerequisites. To satisfy the prerequisite, the student needs to have obtained the grade B or higher.Order the result byssn. f. Find courses (dcode, cno) that do not have prerequisites. Order the resultby dcode, cno. g. Find courses (dcode, cno) that do have some prerequisites. Order the resultby dcode, cno. h. Find classes (class, dcode, cno, instr) that are offered this semester and haveprerequisites. Order the result byclass. i. Find students (ssn, name, major, status) who received only the grades Aor B in every course they have taken (must appear in Transcripts). Order the results byssn. j. Find students (ssn, name, major, status) who are currently enrolled in aclass taught by professor Brodsky (name = Brodsky in faculty). Order the result byssn. k. Find students (ssn) from the enrollment table who are enrolled in allclasses. Order the result byssn. l. Find CS students (ssn) from the enrollment table who are enrolled in allmath classes (dcode = MTH). Order the result byssn.

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

Understanding Oracle APEX 5 Application Development

Authors: Edward Sciore

2nd Edition

1484209893, 9781484209899

More Books

Students also viewed these Databases questions

Question

=+How can you use this information to develop a better opening?

Answered: 1 week ago

Question

How many states do not have a sales tax?

Answered: 1 week ago