Module 1: Querying and modifying data
You can interactively query and modify data that is stored in Db2 for z/OS by issuing SQL statements through SPUFI.
Learning objectives
This tutorial shows you how to do the following tasks:
- Issue SQL statements by using SPUFI
- Query data in Db2 tables and view results
- Modify data in Db2 tables and verify the changes
- Create objects
Time required
45 minutes.
Before you begin
- Complete the prerequisites that are listed in the introduction to this tutorial.
- Log on to z/OS by using a TSO session.
- Create or obtain access to a partitioned data set to contain your work. Contact your system administrator to find out the conventions for data sets at your site, or accept the default values. This tutorial assumes that the data set is named USER.SRCLIB.TUTORIAL.
- Lesson 1.1: Querying data interactively
One of the most basic database tasks is to query the data that the database contains. Even if you are new to Db2 for z/OS, you might already know how to query data in other databases. In fact, you can use many different methods and tools to access data that is stored in Db2 for z/OS databases, including tools that provide modern graphical user-interfaces. However, this lesson provides an opportunity for you learn how to query data by using the commands and menus of the panel-based SPUFI facility in the z/OS terminal interface. - Lesson 1.2: Creating a table
You can create tables and other database objects interactively by issuing SQL statements from SPUFI. In this lesson, you will create a new table that has the same format and contains the same data as the sample EMP table that you queried in the previous lesson. In the next lesson, you can modify data in the new table that you created, without making any changes to the original sample data. - Lesson 1.3: Modifying data interactively
Just as you can query data in Db2 tables and to create database objects by issuing SQL statements in SPUFI, you can also insert, update, and delete data in Db2 tables. In this lesson, you will add a row for a new employee to the MY_EMP table that you created in the previous lesson, modify a value in the row, and finally delete the new row. Along the way, you will learn how to verify the result of each of the actions, all by using SPUFI.