
Answer:
Check the explanation
Explanation:
use `my_guitar_shop`;
#delete the procedure test if it exists.
DROP PROCEDURE IF EXISTS test;
DELIMITER //
CREATE PROCEDURE test ()
BEGIN
  #declare variable sqlerr to store if there is an sql exception
 declare sqlerr tinyint default false;
  #declare variable handler to flag when duplicate value is inserted
 declare continue handler for 1062 set sqlerr = TRUE;
  #start transaction
  start transaction;
 delete from order_items where order_id in
   (select order_id from orders where customer_id=6);
 delete from orders where customer_id=6;
 delete from addresses where customer_id=6;
 delete from customers where customer_id=6;
Â
  if sqlerr=FALSE then
   commit;
    select 'Transaction Committed' as msg;
 else
    rollback;
    select 'Transaction rollbacked' as msg;
  end if;
end //
delimiter ;
call test();