Introduction to Data Management

Accessing Databases With NonStop SQL
3-12 15873 Tandem Computers Incorporated
Figure 3-5. Developing Queries and Reports
S8020-011
SQL
Report
Writer
SELECT FNAME, LNAME, SID
FROM STUDENT WHERE DEPTID = "BUSAD" ;
OUT_REPORT $S.#LASER ;
SET LIST_COUNT 0 ;
SELECT FNAME, LNAME, SID
FROM STUDENT WHERE DEPTID = "BUSAD" ;
REPORT TITLE "Business Administration Students" ;
DETAIL FNAME HEADING "Student Name" ,
LNAME NOHEAD, SID HEADING "ID No." ;
LIST ALL ;
Business
Data
Data
Dictionary
Business
Professional
SQLCI
...... ......
...... ......
...... ......
Formatted
Report
Entering Queries
You can use SQLCI to access the database with spontaneous queries about the data.
You choose any of four simple SQL data manipulation statements to select values
from the database, insert values into the database, update values, or delete values. In
a query, you can select only a few columns or a few rows from any particular table, or
you can select columns and rows from several tables. As noted earlier, you can
combine columns and rows from multiple tables to create views and store those views
in the data dictionary.
Suppose, for instance, that you work in the registrar’s office at a large college. The
student records are recorded in a relational database. You wish to know the first
names, last names, and student identification numbers of all students in the Business
Administration Department. You could retrieve this information just by entering a
simple query like the following:
SELECT FNAME, LNAME, SID FROM STUDENT WHERE DEPTID = "BUSAD" ;
In response, SQLCI presents a list that resembles the one shown in Figure 3-6.