Structured Query Language (SQL) lets users access and manipulate data in relational database management systems. Now that you have learned about the fundamentals of DB2, this chapter shows you how to leverage the power of SQL to obtain and update data that is stored in DB2 databases. The examples provided in this chapter use the sample database. Chapter 8, The DB2 Storage Model, describes the sample database in more detail.
In this chapter you will learn about:
The SELECT SQL statement to query data
The INSERT, UPDATE, and DELETE SQL statements to modify data
Recursive SQL statements
Select query data that just got inserted, updated, or deleted in the same SQL statement
The MERGE SQL statement to combine insert, update, or delete operations in one statement
NOTEIf you are following the examples in this chapter using the Command Line Processor (CLP), the Command Window, or the Command Editor, these tools have autocommit enabled by default, so the changes you make will be stored permanently on disk. Refer to Chapter 4, Using the DB2 Tools, for more information. |