(c) Describe the relation that would be produced vy relational calculus (10 poin
ID: 3600474 • Letter: #
Question
(c) Describe the relation that would be produced vy relational calculus (10 points) 5. Consider the following class database schema: Stu (30 Points) dents (stuNo, fName, IName, address, DOB, sex, depNo) Department (depNo, depName Instructor (instructorNo, depNo, fName, IName) Class (classNo, className, instructorNo, depNo) Registration(StuNo, classNo, semester) StudyOn ( stuNo, classNo, dateStudied, hoursStudied) Formulate the following queries in SQL 5.1 List all details of students who are female (5 Points) List all student names who study in the CS departme 5.2 the database class. (10 Points)Explanation / Answer
Students(stuNo,fName,lName,address,DOB,sex,depNo)
Department(depNo,depName)
Instructor(instructorNo,depNo,fName,lName)
Class(classNo,className,instructorNo,depNo)
Registration(stuNo,classNo,semester)
StudyOn(stuNo,classNo,dateStudied,hoursStudied)
5.1) For getting all information of students who are female, we need to join all the available table as below mentioned.
select Students.stuNo,Students.fName,Students.lName,Students.address,Students.DOB,Students.depNo,Department.depName,Instructor.fName as Instructor_Name,Class.className,Registration.semester,StudyOn.dateStudied
from
Students join Department on Students.depNo = Department.depNo
join Instructor on Department.depNo = Instructor.depNo
join Class on Department.depNo = Class.depNo
join Registration on Students.stuNo = Registration.stuNo
join StudyOn on Students.stuNo = StudyOn.stuNo
where Students.sex='Female'
5.2) List the student name who study in CS department and in the database class.
select Students.stuNo,Students.fName,Students.lName
from
Students join Department on Students.depNo = Department.depNo
join Class on Department.depNo = Class.depNo
where Department.depName = 'CS' and Class.className = 'database'
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.