Created
December 4, 2012 19:20
-
-
Save rustymyers/4207703 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TRIGGER movie_rental_insert On customer_rentals | |
FOR INSERT | |
AS BEGIN | |
UPDATE movies | |
SET num_rentals = num_rentals + 1 | |
WHERE INSERTED.movie_id = movies.movie_id | |
END; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
CREATE TRIGGER movie_rental_insert On customer_rentals
FOR INSERT
AS BEGIN
UPDATE movies
SET num_rentals = num_rentals + 1
WHERE customer_rentals.movie_id = movies.movie_id
END;