Skip to content

Instantly share code, notes, and snippets.

@uncoded-ro
Last active February 9, 2020 03:17
Show Gist options
  • Save uncoded-ro/75a81c30fd5c148a93515cd2fd6b545f to your computer and use it in GitHub Desktop.
Save uncoded-ro/75a81c30fd5c148a93515cd2fd6b545f to your computer and use it in GitHub Desktop.
USE sakila;
DROP PROCEDURE IF EXISTS film_actors;
DELIMITER |
CREATE PROCEDURE film_actors(IN film_title VARCHAR(45), OUT no_actors INT)
BEGIN
SELECT COUNT(a.actor_id) INTO no_actors
FROM actor AS a
INNER JOIN film_actor USING(actor_id)
INNER JOIN film AS f USING(film_id)
WHERE f.title = film_title;
END |
DELIMITER ;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment