forked from ADB-course/20240819-20241125-adb-bbit2-2-classroom-semester-project-BBT3104-SemesterProject
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.sql
More file actions
24 lines (23 loc) · 725 Bytes
/
script.sql
File metadata and controls
24 lines (23 loc) · 725 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
-- Procedure to generate a monthly sales report
DELIMITER //
CREATE PROCEDURE GenerationOfMonthlySalesReport()
BEGIN
SELECT
p.product_name,
SUM(o.order_quantity) AS total_sales,
SUM(o.order_quantity * p.product_price) AS total_revenue
FROM Order o
JOIN Product p ON o.product_id = p.product_id
WHERE o.order_date BETWEEN CURDATE() - INTERVAL 1 MONTH AND CURDATE()
GROUP BY p.product_name;
END //
DELIMITER ;
-- Procedure to retrieve employee performance by department
DELIMITER //
CREATE PROCEDURE RetrievalOfEmployeePerformance(department_id INT)
BEGIN
SELECT employee_name, performance_rating
FROM Employee
WHERE department_id = department_id;
END //
DELIMITER ;