Given the database table below, write a stored procedure called SP Get BC Statio
ID: 3806546 • Letter: G
Question
Given the database table below, write a stored procedure called SP Get BC Station info. This stored procedure will accept a single argument that represents the format field. The stored procedure will get all information from the table below based on this parameter and order the data by 'city'. You will create this stored procedure in a text file that can be run using the MySQL 'source' command. Write the Stored Procedure below: Show an example how this stored procedure would be called using the MySQL command line interface:Explanation / Answer
Almost all stored procedures that you develop require parameters. The parameters make the stored procedure more flexible and useful. In MySQL, a parameter has one of three modes: IN,OUT, or INOUT. We are using IN parameter here:
CREATE PROCEDURE SP_GetBCStationInfo (IN callSign varchar(4))
BEGIN
SELECT call_sign,station,city,format
FROM fn_stations
WHERE call_sign = callSign
GROUP BY call_sign,station,city,format
ORDER BY city;
END
DELIMITER ;
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.