X


The Relational Algebra






The Select Operation





Q . To select those tuples of the instructor relation where the instructor is in the “Physics” department. [ Hint : instructor (ID, name, dept_name, salary) ]



Q . To find all instructors with salary greater than $90,000. [ Hint : instructor (ID, name, dept_name, salary) ]



Q . To find the instructors in Physics with a salary greater than $90,000. [ Hint : instructor (ID, name, dept_name, salary) ]



The Project Operation





Q . To Find the id, salary, name of all instructors. [ Hint : instructor (ID, name, dept_name, salary) ]



Q . Find the name of all instructors in the Physics department. [ Hint : instructor (ID, name, dept_name, salary) ]



The Union Operation :



Q . To Find the set of all courses taught in the Fall 2009 semester, the Spring 2010 semester, or both. [ Hint : section ( course_id, sec_id, semester, year, building, room_number, time_slot_id ) ]





The Set-Difference Operation



To find all the courses taught in the Fall 2009 semester but not in Spring 2010 semester [ Hint : section ( course_id, sec_id, semester, year, building, room_number, time_slot_id ) ]





The Cartesian-Product Operation



To find the names of all instructors in the Physics department together with the course id of all courses they taught. [ Hint : instructor ( ID, name, dept name, salary ) and teaches ( ID, course id, sec id, semester, year ) ]





To find the names of all instructors in the Physics department together with the course id of all courses they taught. [ Hint : instructor ( ID, name, dept name, salary ) and teaches ( ID, course id, sec id, semester, year ) ]



The Rename Operation






Additional Relational - Algebra Operations






Find the names of all instructors in the Comp. Sci. department together with the course titles of all the courses that the instructors teach. [ Hint : instructor ( ID, name, dept name, salary ) , teaches ( ID, course id, sec id, semester, year ) , course ( course_id, title, dept_name, credits ) ]



Demonstrate Outer join Operations.






Extended Relational-Algebra Operations






The general form of the aggregation operation G is as follows:



Q. Find the average salary in each department [ Hint : instructor ( ID, name, dept_name, salary ) ]


Previous Next