0% found this document useful (0 votes)
326 views2 pages

Chapter 2 My Guitar Shop Exercises

This document provides exercises for using MySQL Workbench to create and manage the My Guitar Shop database. It includes steps for installing necessary software, executing SQL scripts, and running SQL statements to interact with the database. The exercises guide users through reviewing database objects and manipulating data within the My Guitar Shop database.

Uploaded by

raissatamali
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
326 views2 pages

Chapter 2 My Guitar Shop Exercises

This document provides exercises for using MySQL Workbench to create and manage the My Guitar Shop database. It includes steps for installing necessary software, executing SQL scripts, and running SQL statements to interact with the database. The exercises guide users through reviewing database objects and manipulating data within the My Guitar Shop database.

Uploaded by

raissatamali
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

1 My Guitar Shop Exercises for Murach’s MySQL (2nd Edition)

Chapter 2
How to use MySQL Workbench
and other development tools
Before you start the exercises
Before you start these exercises, you need to install the MySQL server and MySQL
Workbench. The procedures for doing that are provided in appendix A (Windows) and B
(Mac).
In addition, you’ll need to get the mgs_ex_starts directory from your instructor. This
directory contains some script files that you need to do the exercises.

Exercises
In these exercises, you’ll use MySQL Workbench to create the My Guitar Shop database,
to review the tables in this database, and to enter SQL statements and run them against
this database.
Make sure the MySQL server is running
1. Start MySQL Workbench and open a connection for the root user.
2. Check whether the MySQL server is running. If it isn’t, start it.
Use MySQL Workbench to create the My Guitar Shop database.
3. Open the script file named my_guitar_shop.sql that’s in the mgs_ex_starts directory
by clicking the Open SQL Script File button in the SQL Editor toolbar. Then, use the
resulting dialog box to locate and open the file.
4. Execute the entire script by clicking the Execute SQL Script button in the SQL editor
toolbar or by pressing Ctrl+Shift+Enter. When you do, the Output window displays
messages that indicate whether the script executed successfully.
Use MySQL Workbench to review the My Guitar Shop database
5. In the Schemas category of the Navigator window, expand the node for the database
named my_guitar_shop so you can see all of the database objects it contains. If it
isn’t displayed in the Schemas tab of the Navigator window, you may need to click
on the Refresh button to display it.
6. View the data for the Categories and Products tables.
7. Navigate through the database objects and view the column definitions for at least the
Categories and Products tables.
2 My Guitar Shop Exercises for Murach’s MySQL (2nd Edition)

Use MySQL Workbench to enter and run SQL statements


8. Double-click on the my_guitar_shop database to set it as the default database. When
you do that, MySQL Workbench should display the database in bold.
9. Open a SQL editor tab. Then, enter and run this SQL statement:
SELECT product_name FROM products
10. Delete the e at the end of product_name and run the statement again. Note the error
number and the description of the error.
11. Open another SQL editor tab. Then, enter and run this statement:
SELECT COUNT(*) AS number_of_products
FROM products
Use MySQL Workbench to open and run scripts
12. Open the script named product_details.sql that’s in the mgs_ex_starts directory. Note
that this script contains just one SQL statement. Then, run the statement.
13. Open the script named product_summary.sql that’s in the mgs_ex_starts directory.
Note that this opens another SQL editor tab.
14. Open the script named product_statements.sql that’s in the mgs_ex_starts directory.
Notice that this script contains two SQL statements that end with semicolons.
15. Press the Ctrl+Shift+Enter keys or click the Execute SQL Script button to run both of
the statements in this script. Note that this displays the results in two Result tabs.
Make sure to view the results of both SELECT statements.
16. Move the insertion point into the first statement and press Ctrl+Enter to run just that
statement.
17. Move the insertion point into the second statement and press Ctrl+Enter to run just
that statement.
18. Exit from MySQL Workbench.

You might also like