Team Fly 

Page 38

FL Florida
MN Maine
6 rows selected.

Notice the use of the asterisk in the select statement. The asterisk means ''retrieve data from all the columns" of a given table.

Rather than using the asterisk as we did in the previous example, we can specify one or more columns after the select command in a comma-separated list. Let's rewrite the previous query and only select the state_name column:

SQL> select state_name
  2  from   state;
STATE_NAME
------------------------------
Arizona
New Jersey
California
Texas
Florida
Maine
6 rows selected.

The semicolons in the two SQL examples force the immediate execution of the SQL statement within SQL*Plus. There are two ways in SQL*Plus to signify you have finished and that the SQL statement can be executed:

Image The semicolon at the end of a line

Image The slash on a separate line

Until SQL*Plus encounters either of these characters, it assumes you need an additional line. The following example highlights this point. Notice the use of the slash and semicolon.

SQL> select *
  2  from   a;
SQL> select *
  2  from   a
  3  /

The absence of the semicolon in the second example resulted in a new line. In these cases, the semicolon and slash on a separate line would force the execution of the statement.

Team Fly 
0057