Writing SQL queries to answer questions: The basics

You can retrieve data by using the SQL statement SELECT to specify a result table that can be derived from one or more tables. This section provides examples of SQL statements that illustrate how to code and use each clause of the SELECT statement to query a table. Examples of more advanced queries explain how to fine-tune your queries by using functions and expressions and how to query multiple tables with more complex queries that include unions, joins, and subqueries.

The best way to learn SQL is to develop SQL statements similar to these examples and then execute them dynamically by using a tool such as DB2 QMF for Windows.

The data that is retrieved through SQL is always in the form of ...

Get Official Introduction to DB2® for z/OS®, The, 2nd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.