Advertisement
elena1234

stored procedure blank in MySQL

Feb 16th, 2023 (edited)
1,251
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 0.45 KB | Source Code | 0 0
  1. DELIMITER $$
  2. CREATE PROCEDURE sp_select_all_staff ()
  3.       BEGIN
  4.        SELECT first_name, last_name, staff_id
  5.        FROM staff;
  6.       END;
  7. $$
  8.  
  9. DELIMITER ;
  10.  
  11. CALL sp_select_all_staff ();
  12.  
  13.  
  14. **************************************
  15. DELIMITER $$
  16. CREATE PROCEDURE sp_staffOrdersServed()
  17. BEGIN
  18.     SELECT staff_id,
  19.            COUNT(order_id) as orders_served
  20.     FROM customer_orders
  21.     GROUP BY staff_id;
  22. END;
  23. $$
  24.  
  25. DELIMITER ;
  26.  
  27. CALL sp_staffOrdersServed();
  28.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement