Explain what relational algebra is and provide an example showing how it is used.
Added by Dylan M.
Step 1
Let's think step by step. Show more…
Show all steps
Your feedback will help us improve your experience
Akash M and 82 other AP CS educators are ready to help you.
Ask a new question
Labs
Want to see this concept in action?
Explore this concept interactively to see how it behaves as you change inputs.
Key Concepts
Recommended Videos
The following tables form part of a database held in an RDBMS: Employee (empNo, fName, lName, address, DOB, sex, position, deptNo) Department (deptNo, deptName, mgrEmpNo) Project (projNo, projName, deptNo) WorksOn (empNo, projNo, dateWorked, hoursWorked) Where: - Employee table contains employee details and empNo is the key. - Department table contains department details and deptNo is the key. mgrEmpNo identifies the employee who is the manager of the department. There is only one manager for each department. - Project table contains details of the projects in each department and the key is projNo (no two departments can run the same project). - WorksOn table contains details of the hours worked by employees on each project, and empNo/projNo/dateWorked form the key.
Akash M.
Consider the following database: Employee (person name, street, city), Works (person name, street, city), manages (person name, manager name). Using relational algebra, answer the following queries: 1. Find the names of all employees who earn more than every employee of the company "Company A". 2. Find the names of all employees who live in the same city as their managers.
Consider the following relational database: employee (person_name, street, city) works (person_name, company_name, salary) company (company_name, city) manages(person_name, manager_name) Write the following queries in relational algebra. [20 points] Use natural join to find names of employees who work for a company located in the city "Springfield". Schema of the output should be (person_name, company_name). [20 points] Find number of employees managed by each manager. Rename the count as numManaged. I.e., schema of the output should be (manager_name, numManaged). Use the assignment operator to store the result in a relation with the name r. [20 points] Use the relation r that you found in the previous question to find names of managers who manage at least 10 employees. [20 points] Find person_name of the employee(s) who earns the highest salary. Make sure to use an aggregate function to help you answer this question. [20 points] Assume that a company can be located in several cities (remark: this will imply that company_name is no longer primary key for company.) Find company_name for companies that are located in every city where the company "Fedco" is located.
Aarya B.
Recommended Textbooks
Computer Science and Information Technology
Introduction to Programming Using Python
Computer Science - An Overview
Transcript
18,000,000+
Students on Numerade
Trusted by students at 8,000+ universities
Watch the video solution with this free unlock.
EMAIL
PASSWORD