Solution to Activity 10.3
The solution to this activity is as follows:
- First, we need to develop SQL code to create the stored procedures. This will be done in a new SQL tab in Workbench.
- Instruct MySQL to use the
ms_access_migration
database for all subsequent commands:USE ms_access_migration;
- Drop the existing
spGroupsList
stored procedure if it exists:DROP PROCEDURE IF EXISTS spGroupsList;
- Set the customized delimiter:
DELIMITER //
- Create the
spGroupsList
procedure:CREATE PROCEDURE spGroupsList()
- Include a
BEGIN
statement to indicate where the code starts:BEGIN
- The SQL statement will query the database. The records will be returned from the procedure:
SELECT DISTINCT series.Group FROM series ORDER BY series.Group;
- End the block and delimiter:
END//
- Reset the delimiter back to the default:
DELIMITER ;
- Inside
spCountryList
, instruct MySQL to use thems_access_migration
database for all subsequent commands:USE ms_access_migration;
...