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

find the highest produc ing mechanic (quantity of appts) with a SQL QUERY shop(l

ID: 655107 • Letter: F

Question

find the highest producing mechanic (quantity of appts) with a SQL QUERY

shop(location num, address, no_of_bays, phone, fax) employee(emp id. location num, home_address, wage, is_hourly, date_of_hire) admin(emp id, position) mechanic(emp id,years_exp) mechanic certs(emp id, cert ore, cert name) mechanic appt(emp id. appt no) service appt(appt no, is_completed, date_time,type) auto_appt(appt_no, vin) auto(vin. cust no. year, type, engine, transmission) customer(cust no, name, address, phone_l, phone_2)

Explanation / Answer

SQL Query:

select m.emp_id,count(*) as cnt
from mechanic_appt m,service_appt s
where
m.appt_no=s.appt_no
and s.is_completed=1
group by m.emp_id
order by cnt desc;

The highest producing mechanic(quantity of appts) will be the emp_id with maximum count shown at the top of the query result