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

For the schema (shown below, with primary keys indicated), write RA query for ea

ID: 2247785 • Letter: F

Question

For the schema (shown below, with primary keys indicated), write RA query for each of the following. (State any reasonable assumptions if necessary.) You may write

a query in several steps.

Employee ( person_name, street, city)

Works(person_name, company_name, salary)

Company (company_name, city)

(a)Find the names of all employees in this database who do NOT livein the same city as the company for which they work. [Note: You should understand what “...the same city as the company for which they work” means.]

(b)Find the smallest total number of employees (of any company).

Explanation / Answer

1). person_name(employee ./ works ./ company)

ii. {p|e employee(c company(w works(w.company_name c.company_namep.person_name e.person_namee.person_name w.personname e.city c.city)))}

iii. {hperson_namei|company_name, salary(hperson_name, company_name, salaryi works(c, v(hcompany_name, ci company hperson_name, v, ci employee)))}

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

t2 maxnum-employees(company-strength(company-name,num-employees)(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