Introduction to NonStop SQL/MP
Querying the Database
How to Use NonStop SQL
2–2 113425 Tandem Computers Incorporated
The DBA also manages the physical configuration of database files on the Tandem
system. Because NonStop SQL/MP keeps the logical database structure independent
of the underlying physical database structure, the query writer does not need to know
anything about the physical structure.
Selecting Data The SELECT statement enables you to write queries that select particular rows and
columns, join two or more tables into a single result, and even make further selections
from the result. In a SELECT statement, you can specify the result you want in the
following ways:
Select columns by naming the columns (this is called projection)
Select rows by specifying conditions for selection (this is called restriction)
Join tables by naming the tables, specifying the columns in the result, specifying
the join conditions (the columns on which the join is performed), and specifying
conditions for selection
Specify a union operation between the results of two SELECT statements
Figure 2-1 shows a sample personnel database. The examples in this manual use the
personnel database.
Figure 2-1. Personnel Database Example
004
DEPT Table
LOCATIONDEPTNUM DEPTNAME MANAGER RPTDEPT
1000
FINANCE
23
1500
PERSONNEL
213
1
9000
CORPORATE
CHICAGO
CHICAGO
CHICAGO
••• ••• •••
9000
1000
9000
••• •••
JOB Table
100 MANAGER
250 ASSEMBLER
900
SECRETARY
JOBCODE JOBDESC
JOB Table
••• •••
ROGER
JERRY
JESSICA
GREEN
HOWARD
CRINER
9000
1000
3500
100
100
300
175500.00
137000.10
39500.00
EMPNUM FIRST_NAME LAST_NAME DEPTNUM JOBCODE SALARY
EMPLOYEE Table
1
23
568
••• ••• ••• ••• ••• •••