Database Reference
In-Depth Information
We recommend that you create a folder for each database in the Projects folder. We have
created a folder named DBC-e13-Cape-Codd-Database to store the script files associated with
the Cape Codd database.
Saving a Microsoft SQL Server Query as an SQL Script in Microsoft SQL Server Management
Studio
1.
Click the Save button shown in Figure 2-17. The Save File As dialog appears, as shown
in Figure 2-17.
2.
Browse to the \My Documents\SQL Server Management Studio\Projects\DBP-e13-Cape-
Codd-Database folder.
3.
Note that there are already two SQL script names displayed in the dialog box. These
are the SQL scripts that were used to create and populate the Cape Codd database
tables, and they are available on our Web site at www.pearsonhighered.com/kroenke .
4.
In the File Name text box, type the SQL script file name SQL-Query-CH02-01.
5.
Click the Save button.
To rerun the saved query, you would click the Open File button shown in Figure 2-17 to open
the Open File dialog box, open the query, and then click the Execute button.
At this point, you should work through each of the other nine queries in the pre-
ceding discussion of the SQL SELECT/FROM/WHERE framework. Save each query as
SQL-Query-CH02-##, where ## is a sequential number from 02 to 09 that corresponds to the
SQL query label shown in the SQL comment line of each query.
Using SQL in Oracle Database 11 g Release 2
Before you can enter SQL statements into Oracle Database 11 g Release 2 you need access to
a computer that has Oracle Database 11 g Release 2 installed and that has a database with the
tables and data shown in Figures 2-3, 2-4, and 2-5. Your instructor may have installed Oracle
Database 11 g Release 2 on a computer in the lab and entered the data for you. If so, follow his
or her instructions for accessing that database. Otherwise, you will need to obtain a copy of
Oracle Database 11 g Release 2 and install it on your computer. Read the appropriate sections
of Chapter 10B about obtaining and installing Oracle Database 11 g Release 2.
After you have installed Oracle Database 11 g Release 2, you will need to read the introductory
discussion for Oracle Database 11 g Release 2 in Chapter 10B, starting on page 10B-1, and create the
Cape Codd database. Oracle Database 11 g Release 2 scripts for creating and populating the Cape
Codd database tables are available on our Web site at www.pearsonhighered.com/kroenke .
Although Oracle users have been dedicated to the Oracle SQL*Plus command line tool,
professionals are moving to the new Oracle SQL Developer GUI tool. This application is
installed as part of the Oracle Database 11 g Release 2 installation, and updated versions are
available for free download at www.oracle.com/technology/software/products/sql/index.html .
We will use it as our standard GUI tool for managing the databases created by the Oracle
Database DBMS. Figure 2-18 shows the execution of SQL-Query-CH02-01 (note that the SQL
comment is not included in the SQL statement as run—also note that the SQL comment could
have been included in the SQL code if we had chosen to include it):
/* *** SQL-Query-CH02-01 *** */
SELECT
Department, Buyer
FROM
SKU_DATA;
Running an SQL Query in Oracle SQL Developer
1.
Click the New Connection button and open the Cape Codd database.
2.
In the tabbed SQL Worksheet, type the SQL SELECT command ( without the SQL
comment line shown above):
SELECT
Department, Buyer
FROM
SKU_DATA;
as shown in Figure 2-18.
 
Search WWH ::




Custom Search