Question
Solve using Relational Algebra (A similar question was posted before but its not relational algebra) I have posted below solutions to another Relational Algebra question
Solve using Relational Algebra (A similar question was posted before but its not relational algebra) I have posted below solutions to another Relational Algebra question from my textbook which shows how to answer the question
PLEASE SOLVE I CANT FIGURE THIS OUT
_________________________________________________________________________
How I would like the format to be answered. Here are a couple of screenshots of other solutions to relational algebra questions. If possible please answer in this format Thankyou very much. NOTE YOU DONT NEED TOO ANSWER THESE I JUST WANT THE SOLUTIONS FORMATED LIKE THIS
Part 1: Relational Algebra Queries The queries in this section will be based on the following relational schema: Student (SID, given name, surname, username, major) Enrolled (SID, OID, grade) Offering(IOID, course_code, year, term, duration) Course (course code, description, department, weight) PreReq (enrolled course, required course, min_grade) Here is a subset of a typical student database schema which would record student enrollment. A course is the generic description of a course which is offered by a department, the prereq relation indicates what courses are prerequisites for other courses. The offering relation is the specific instance of a course being taught in a given term, and is the entity which will be associated with the student enrollment. 1. Write a query which will list the course_code, year, term, duration and grade for all the courses taken by the student with SID "1357246". 2. Write a query which will list the SID, given_name and surname of the students who achieved a grade of 95% or greater in the 2022 school year. 3. Write a query which will list the full student record for any student who has never registered in a course. 4. Write a query which will list the surnames of the students who are enrolled in both "COSC 2P13" and "COSC 3P32" in the Winter 2023 term (2022 FW 03). 5. Write a query which will list the SID of any student in the Winter (2022 FW 03) offering of COSC3P32 who does not have the proper prerequisites for the course. 6. Write a query which will list the SID and surname of the student(s) who have taken all of the courses associated with the "Computer Science" department. 7. Write a query which will list the full name and the grade of the students who received one of the two highest marks in "COSC3P32" for the school year 2022 (two distinctly different marks, so there may be more than 2 studetns listed). Exercise 4.3 Consider the following schema: Suppliers(sid: integer, sname: string, address: string) Parts (pid: integer, pname: string, color: string) Catalog(sid: integer, pid: integer, cost: real) The key fields are underlined, and the domain of each field is listed after the field name Therefore sid is the key for Suppliers, pid is the key for Parts, and sid and pid together form the key for Catalog. The Catalog relation lists the prices charged for parts by Suppliers. Writ the following quries in relational algebra, tuple relational calculus, and domain relationa calculus: 1. Find the names of suppliers who supply some red part. 2. Find the sids of suppliers who supply some red or green part. 3. Find the sids of suppliers who supply some red part or are at 221 Packer Ave. 4. Find the sids of suppliers who supply some red part and some green part. 128 CHAPtER 4 5. Find the sids of suppliers who supply every part. 6. Find the sids of suppliers who supply every red part. 7. Find the sids of suppliers who supply every red or green part. 8. Find the sids of suppliers who supply every red part or supply every green part. 9. Find pairs of sids such that the supplier with the first sid charges more for some part than the supplier with the second sid. 10. Find the pids of parts supplied by at least two different suppliers. 11. Find the pids of the most expensive parts supplied by suppliers named Yosemite Sham. 12. Find the pids of parts supplied by every supplier at less than $200. (If any supplier either does not supply the part or charges more than $200 for it, the part is not selected.) 1. RA sname(sid((pidcolor=redParts)Catalog)Suppliers) 2. RA sid(pid(color=redcolor=greenParts)catalog) 3. RA (R1,sid((pidcolor=redParts)Catalog))(R2,sidaddress=221PackerStreetSuppliers)R1R2 4. RA (R1,sid((pidcolor=redParts)Catalog))(R2,sid((pidcolor==greenParts)Catalog))R1R2 5. RA (sid,pidCatalog)/(pidParts) 6. RA (sid,pidCatalog)/(pidcolor=redParts) 7. RA (sid,pidCatalog)/(pidcolor=redcolor=greenParts) 8. RA (R1,((sid,pidCatalog)/(pidcolor=redParts)))(R2,((sid,pidCatalog)/(pidcolor=greenParts)))R1R2 9. - RA (R1,Catalog)(R2,Catalog)R1.sid,R2.sid(R1.pid=R2.pidR1.sid=R2.sidR1.cost>R2.cost(R1R2)) 10. RA (R1,Catalog)(R2,Catalog)R1.pidR1.pid=R2.pidR1.sid=R2.sid(R1R2) 11. RA (R1,sidsname=YosemiteShamSuppliers)(R2,R1Catalog)(R3,R2)(R4(1sid,2pid,3cost),R3.cost
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started