Datasheet
28
Chapter 1
Introducing SQL
SELECT * FROM TAB; shows all the tables and views in your
schema. Don’t be alarmed if you see a table name similar to
BIN$PJV23QpwQfu0zPN9uaXw+w==$0. These are tables that belong
to the Recycle Bin (or dropped tables). The tasks of creating tables
and managing tables are discussed in Chapter 6.
The DUAL Table
The DUAL table is a dummy table available to all users in the database. It has one column
and one row. The
DUAL table is used to select system variables or to evaluate an expression.
Here are few examples. The first query is to show the contents of the
DUAL table.
SQL> SELECT * FROM dual;
DUMMY
-----
X
SQL> SELECT SYSDATE, USER FROM dual;
SYSDATE USER
--------- ------------------------------
18-SEP-07 HR
SQL> SELECT ‘I’’m ‘ || user || ‘ Today is ‘ || SYSDATE
2 FROM dual;
‘I’’M’||USER||’TODAYIS’||SYSDATE
-----------------------------------------------------
I’m HR Today is 18-SEP-07
SYSDATE
and USER are built-in functions that provide information about the
environment. These functions are discussed in Chapter 2, “Using Single-
Row Functions.”
Limiting Rows
You can use the WHERE clause in the SELECT statement to limit the number of rows pro-
cessed. Any logical conditions of the
WHERE clause use the comparison operators. Rows
95127c01.indd 28 2/18/09 6:37:09 AM