Changes between Version 1 and Version 2 of AdvancedReport17
- Timestamp:
- 08/21/26 07:08:29 (26 hours ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
AdvancedReport17
v1 v2 3 3 CREATE OR REPLACE FUNCTION get_employee_product_changes_last_month() 4 4 RETURNS TABLE ( 5 ssnBIGINT,5 id BIGINT, 6 6 employee_name TEXT, 7 7 number_of_product_changes BIGINT … … 12 12 RETURN QUERY 13 13 SELECT 14 e. ssn,14 e.id, 15 15 p.name AS employee_name, 16 16 COUNT(DISTINCT mc.date_and_time) AS number_of_product_changes 17 17 FROM employees e 18 18 JOIN personal p 19 ON e. ssn = p.ssn19 ON e.id = p.id 20 20 LEFT JOIN makes_change mc 21 ON e. ssn = mc.ssn21 ON e.id = mc.id 22 22 LEFT JOIN change ch 23 23 ON mc.date_and_time = ch.date_and_time … … 26 26 AND mc.date_and_time < date_trunc('month', CURRENT_DATE) 27 27 GROUP BY 28 e. ssn,28 e.id, 29 29 p.name 30 30 ORDER BY … … 42 42 43 43 **JOIN employees with their personal information:** 44 - J1 ← E ⨝E. SSN = P.SSNP44 - J1 ← E ⨝E.id= P.id P 45 45 46 46 **JOIN employees with the changes they have made:** 47 - J2 ← J1 ⨝E. SSN = MC.SSNMC47 - J2 ← J1 ⨝E.id = MC.id MC 48 48 49 49 **JOIN the changes with the corresponding product:**
