a few examples off the bat:
1) where I want either both transactions to succeed or both fail:
Code:
START TRANSACTION;
INSERT INTO table1 (column1) VALUES ('value1');
INSERT INTO table2 (column2) VALUES ('value2');
COMMIT;
2) or in a case where I want to do multiple things with the same data:
Code:
INSERT INTO table1 (column1, column2) VALUES (value1, value2);
UPDATE table2 SET column1 = value1 WHERE condition;
DELETE FROM table3 WHERE condition;
3) multiple selects where ARRAYAGG or UNION won't work ( for example, because there are different number of columns in each table)
Code:
SELECT * FROM clients WHERE client_id = '1';
SELECT * FROM cases WHERE case_client_id ='1';
4) procedures
Code:
DELIMITER //
CREATE PROCEDURE procedure_example()
BEGIN
SELECT * FROM table1 WHERE condition1;
UPDATE table2 SET column1 = value1 WHERE condition2;
END //
DELIMITER ;
I am sure there are many more (security, log or audit layers)