Datasheet
SQL Fundamentals
7
Since the test is on SQL and the tool used throughout the book for executing SQL is
SQL*Plus, I will discuss some fundamentals of SQL*Plus in this section.
SQL*Plus, widely used by DBAs and developers to interact with the database, is a pow-
erful tool from Oracle. Using SQL*Plus, you can execute all SQL statements and PL/SQL
programs, format results from queries, and administer the database.
SQL*Plus is packaged with the Oracle software and can be installed using the client soft-
ware installation routine on any machine. This tool is automatically installed when you install
the server software.
On Unix/Linux platforms, you can invoke SQL*Plus using the
sqlplus executable found in
the
$ORACLE_HOME/bin directory. On Windows and Unix/Linux platforms, when you start
SQL*Plus, you will be prompted for a username and password, as shown in Figure 1.1.
FIGURE 1.1 SQL*Plus screen
Once you are in SQL*Plus, you can connect to another database or change your connec-
tion by using the
CONNECT command, with this syntax:
CONNECT <username>/<password>@<connectstring>
The slash separates the username and password. The connect string following @ is the
database alias name. If you omit the password, you will be prompted to enter it. If you
omit the connect string, SQL*Plus tries to connect you to the local database defined in the
ORACLE_SID variable.
You can invoke and connect to SQL*Plus using the
sqlplus command, with this syntax:
sqlplus <username>/<password>@<connectstring>
If you invoke the tool with just sqlplus, you will be prompted for a username and pass-
word. If you invoke SQL*Plus with a username, you will be prompted for a password.
Once you are connected to SQL*Plus, you get the
SQL> prompt. This is the default prompt,
which can be changed using the
SET SQLPROMPT command. Type the command you want to
95127c01.indd 7 2/18/09 6:37:06 AM