NonStop Systems Introduction

The Relational Database Management System
NonStop Systems Introduction527825-001
4-6
Powerful Database Language
Powerful Database Language
SQL/MX implements the ANSI-standard SQL database language to offer simple,
powerful commands for both a data definition language and a data manipulation
language.
The data definition language creates, alters, and deletes the definitions of SQL/MX
objects like tables, views, and indexes. This language includes the statements
CREATE, ALTER, and DROP as well as other statements.
The data manipulation language selects, adds, deletes, and updates the data stored in
tables and views. This language includes the four statements SELECT, INSERT,
DELETE, and UPDATE.
Because of the simplicity of the data manipulation statements, people with very little
computer experience can use SQL to look at their business data or make simple
changes to the data. Yet programmers can use the same commands to write complex
database applications.
Figure 4-3 on page 4-6 shows a simple but powerful query that an end user could
make against the EMPLOYEE table. This SELECT statement instructs SQL/MX to
print the first name (FNAME), last name (LNAME), and employee number (EMPNUM)
of only those employees who are in department (DEPTNUM) 4000.
To understand the power of the simple query shown in Figure 4-3, consider the case of
an organization with thousands of employees who are spread over dozens of
departments. Suppose that the CEO wants to meet with each department in turn, to
tell the employees what the company’s business goals are and how each department
Figure 4-3. A Simple SQL Query
• • • • • • • • • • • • • • •
EMPNUM
1
23
568
FNAME
ROGER
JERRY
JESSICA
LNAME
GREEN
HOWARD
CRINER
4000
1000
3500
100
200
300
75500.00
37000.00
39500.00
EMPLOYEE TABLE
SELECT FNAME, LNAME, EMPNUM
FROM EMPLOYEE
WHERE DEPTNUM = 4000;
FNAME
LNAME EMPNUM
DEPTNUM JOBCODE SALARY
• • •
VST046.vsd
ROGER
TERRY
GREEN
LEE
1
116