Database Reference
In-Depth Information
3.
Click the Execute Current SQL Statement in Connected Server button to run
the query. The results are displayed in a tabbed Query Result window, shown as the
Query 1 Result window in Figure 2-20 (you can have more than one Query Result win-
dow open, and thus they need to be numbered).
Note that in Figure 2-20 the Cape Codd database object in the Object Browser in the
left-side window of the MySQL Workbench has been expanded to show the tables in the Cape
Codd database. Many of the functions of the MySQL Workbench are associated with the
objects in the Object Browser and are often accessed by right-clicking the object to display a
shortcut menu.
By The Way We are using MySQL Community Server 5.6 running in Microsoft Server
2012. When we give specific sequences of steps to follow in the text or
figures in this topic, we use the command terminology used for MySQL 5.6 and as-
sociated utility programs in Microsoft Server 2012. If you are running a workstation
operating system such as Microsoft XP, Microsoft Vista, or Linux, the terminology may
vary somewhat.
MySQL 5.6 is an enterprise-class DBMS product and, as is typical of such products, does
not store queries within the DBMS (it does store SQL Views, which can be considered a type
of query, and we will discuss SQL Views later in this chapter). However, you can save MySQL
queries as SQL script files. An SQL script file is a separately stored plain text file, and it usually
uses a file name extension of *.sql. An SQL script file can be opened and run as an SQL com-
mand. Figure 2-21 shows the SQL query being saved as an SQL script file.
Note that in Figure 2-21 the query will be saved in a folder named My Documents\MySQL
Workbench\Schemas\DBP-e13-Cape-Codd-Database. By default, MySQL Workbench stores
files in the user's My Documents folder. We recommend that you create a subfolder in your My
Documents folder named MySQL Workbench and then create subfolders labeled EER Models
and Schemas. Within each of these subfolders, create a sub-subfolder for each MySQL 5.6 data-
base. We have created a folder named DBP-e13-Cape-Codd-Database to store the script files
associated with the Cape Codd database.
Figure 2-21
Saving a MySQL Query as
an SQL Script in the MySQL
Workbench
Click the Save SQL
Script to File button
to open the Save SQL
Script dialog box
The Save SQL
Script dialog box
The My Documents/
MySQL Workbench/
Schemas/DBP-e13-
Cape-Codd-Database
folder
Type the SQL script
File name here
The Save button
Search WWH ::




Custom Search