Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write RA, Relational Algebra, query for each of the following. (Be sure to solve

ID: 3883225 • Letter: W

Question

Write RA, Relational Algebra, query for each of the following.

(Be sure to solve using Relational Algebra)

Employee ( person_name, street, city)

Works (person_name, company_name, salary)

(a) Assume the companies may be located in several cities. Find all companies located in every city in which Union Pacific (UP) is located.

(b) Find the company with the smallest number of employees. [Note: The query should return the name of the company which has the smallest number of employees.]

(c) Find the company with the largest payroll. [Note: Payroll is the sum of salaries for all employees. The query should return the name of the company which has the largest payroll.]

(d) Find those companies whose employees earn a higher salary, on average, than the average salary at First Bank Corporation.

Explanation / Answer

A) Union pacific will be included in each answer.

company-name (company ÷ (city (company-name = “Union Pacific” (company))))

B) t1 company-nameGcount-distinct person-name (works)

     t2 minnum-employees(company-strength(company-name,num-employees)(t1))

     company-name(t3(company-name,num-employees)(t1) t4(num-employees)(t2))

C) t1 company-nameGsum salary(works)

    t2 maxpayroll(company-payroll(company-name,payroll)(t1))

      company-name(t3(company-name,payroll)(t1) t4(payroll)(t2))

D) t1 company-nameGavg salary(works)

      t2 company-name = “First Bank Corporation” (t1)

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote