Write a SQL query to track production output, downtime, and defect rates by shift and site, and summarize the results by week at Amgen.
Use production records with valid site and shift references. Defect rate is defective units divided by produced units, expressed as a percentage.
Output
- One row per site, shift, and week.
- Return
site_name, shift_name, week_start, total_units_produced, total_downtime_minutes, and defect_rate_percent.
- Exclude records without a matching site or shift, order by site name, shift name, and week start, and round the defect rate to two decimal places.