May 2020
Beginner
564 pages
14h 9m
English
Let's begin by dropping the procedure that we created in the previous section with the help of the following code:
USE lahmansbaseballdb;DROP PROCEDURE IF EXISTS getplayergameinfo;
In the preceding code, there is an IF EXISTS in the DROP PROCEDURE statement. This will drop the procedure if it exists, but won't throw an error after dropping it if it doesn't exist.
Next, you will create the procedure, but this time it will have a couple of parameters so that you can change the WHERE clause values:
USE lahmansbaseballdb; DELIMITER $$ CREATE PROCEDURE getplayergameinfo ( IN yearid_in year, IN hits_in smallint ) BEGIN SELECT p.playerid, birthyear, a.yearid, a.teamid,G_defense AS defensegames, H AS numberofhits FROM appearances ...
Read now
Unlock full access