Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
The MySQL Workshop

You're reading from   The MySQL Workshop A practical guide to working with data and managing databases with MySQL

Arrow left icon
Product type Paperback
Published in Apr 2022
Publisher Packt
ISBN-13 9781839214905
Length 726 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Authors (2):
Arrow left icon
Scott Cosentino Scott Cosentino
Author Profile Icon Scott Cosentino
Scott Cosentino
Thomas Pettit Thomas Pettit
Author Profile Icon Thomas Pettit
Thomas Pettit
Arrow right icon
View More author details
Toc

Table of Contents (22) Chapters Close

Preface 1. Section 1: Creating Your Database
2. Chapter 1: Background Concepts FREE CHAPTER 3. Chapter 2: Creating a Database 4. Chapter 3: Using SQL to Work with a Database 5. Chapter 4: Selecting, Aggregating, and Applying Functions 6. Section 2: Managing Your Database
7. Chapter 5: Correlating Data across Tables 8. Chapter 6: Stored Procedures and Other Objects 9. Chapter 7: Creating Database Clients in Node.js 10. Chapter 8: Working with Data Using Node.js 11. Section 3: Querying Your Database
12. Chapter 9: Microsoft Access – Part 1 13. Chapter 10: Microsoft Access – Part 2 14. Chapter 11: MS Excel VBA and MySQL – Part 1 15. Chapter 12: Working With Microsoft Excel VBA – Part 2 16. Section 4: Protecting Your Database
17. Chapter 13: Getting Data into MySQL 18. Chapter 14: Manipulating User Permissions 19. Chapter 15: Logical Backups 20. Other Books You May Enjoy Appendix

Solution to Activity 10.3

The solution to this activity is as follows:

  1. First, we need to develop SQL code to create the stored procedures. This will be done in a new SQL tab in Workbench.
  2. Instruct MySQL to use the ms_access_migration database for all subsequent commands:
    USE ms_access_migration;
  3. Drop the existing spGroupsList stored procedure if it exists:
    DROP PROCEDURE IF EXISTS  spGroupsList;
  4. Set the customized delimiter:
    DELIMITER //
  5. Create the spGroupsList procedure:
    CREATE PROCEDURE spGroupsList()
  6. Include a BEGIN statement to indicate where the code starts:
    BEGIN
  7. 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;
  8. End the block and delimiter:
    END//
  9. Reset the delimiter back to the default:
    DELIMITER ;
  10. Inside spCountryList, instruct MySQL to use the ms_access_migration database for all subsequent commands:
    USE ms_access_migration;
  11. ...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime