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

employee ( employee_name , street , city ) works ( employee_name , company name

ID: 3794045 • Letter: E

Question

employee (employee_name, street, city)

works (employee_name, company name, salary)

company (company_name, city)

manages (employee_name, manager_name)

Consider the employee database of Figure above, where the primary keys are underlined. Give an expression in SQL for each of the following queries.

For companies that have at least three employees, find company name and number of empolyees. Rename the second attribute in the output as number_employees. Remark: this question is similar to the previous one but the output lists only companies with at least three employees.

##An example would be like this

Find the names of all employees who work for “First Bank Corporation”.

answer:

select employee_name

from works

where company_name = ‘First Bank Corporation’

Explanation / Answer

Following is the solution: SELECT company_name, COUNT(employee_name) AS number_employees FROM company WHERE COUNT(employee_name) >=3;