Solution to Activity 10.2
In this activity, you will create a function to count and assign the total groups to the cntGroups
textbox. Follow these steps to complete this activity:
- Copy the
fnCountSeries.sql
file and name the new filefnCountGroups.sql
. - Open the file in a text editor.
- Modify the file.
- Instruct the server to use the
ms_access_migration
database. Always include this command so that there is no question that code will be run against the intended database. Without it, the current active database in the workbench will be used:USE ms_access_migration;
- Drop the existing function named
fnCountGroups
if it already exists:DROP FUNCTION IF EXISTSÂ Â 'fnCountGroups';
- Set a custom delimiter so that all code between the start and end delimiters is to be treated as one set of instructions:
DELIMITER //
- Create the function as named and indicate that it will return a long value:
CREATE FUNCTION 'fnCountGroups'() RETURNS long...