Skip to content

Instantly share code, notes, and snippets.

@uncoded-ro
Last active April 7, 2021 11:39
Show Gist options
  • Save uncoded-ro/e38bfc682f5e6778f415863b7cf2e936 to your computer and use it in GitHub Desktop.
Save uncoded-ro/e38bfc682f5e6778f415863b7cf2e936 to your computer and use it in GitHub Desktop.
SELECT *
FROM sakila.actor
ORDER BY last_update DESC
LIMIT 5;
START TRANSACTION;
INSERT INTO sakila.actor (first_name, last_name)
VALUES ("BRUCE", "JOHNSON");
SELECT last_name INTO @last_name
FROM sakila.actor
WHERE actor_id = LAST_INSERT_ID();
UPDATE sakila.actor
SET last_name = @last_name
WHERE actor_id = 1;
SELECT *
FROM sakila.actor
ORDER BY last_update DESC
LIMIT 5;
ROLLBACK;
SELECT *
FROM sakila.actor
ORDER BY last_update DESC
LIMIT 5;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment