Introduction to Db2 for Z/OS
Total Page:16
File Type:pdf, Size:1020Kb
Db2 12 for z/OS Introduction to Db2 for z/OS IBM SC27-8852-02 Notes Before using this information and the product it supports, be sure to read the general information under "Notices" at the end of this information. Subsequent editions of this PDF will not be delivered in IBM Publications Center. Always download the latest edition from PDF format manuals for Db2 12 for z/OS (Db2 for z/OS in IBM Documentation). 2021-09-17 edition This edition applies to Db2® 12 for z/OS® (product number 5650-DB2), Db2 12 for z/OS Value Unit Edition (product number 5770-AF3), and to any subsequent releases until otherwise indicated in new editions. Make sure you are using the correct edition for the level of the product. Specific changes are indicated by a vertical bar to the left of a change. A vertical bar to the left of a figure caption indicates that the figure has changed. Editorial changes that have no technical significance are not noted. © Copyright International Business Machines Corporation 2001, 2021. US Government Users Restricted Rights – Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. Contents About this information.......................................................................................... ix Who should read this information................................................................................................................x Db2 Utilities Suite for z/OS...........................................................................................................................x Terminology and citations............................................................................................................................x Accessibility features for Db2 12 for z/OS..................................................................................................xi How to send your comments about Db2 for z/OS documentation............................................................ xi Chapter 1. What is Db2 for z/OS?........................................................................... 1 Chapter 2. Db2 for z/OS and SQL concepts............................................................. 3 Submitting SQL statements to Db2............................................................................................................. 3 Static SQL................................................................................................................................................4 Embedded dynamic SQL........................................................................................................................ 5 Deferred embedded SQL........................................................................................................................5 Interactive SQL....................................................................................................................................... 5 SQL Call Level Interface and Open Database Connectivity...................................................................6 Java database connectivity and embedded SQL for Java.....................................................................7 Use of QMF for Workstation................................................................................................................... 7 Db2 database objects overview...................................................................................................................8 Db2 schemas and schema qualifiers........................................................................................................ 10 Db2 tables..................................................................................................................................................12 Db2 keys............................................................................................................................................... 14 Constraints........................................................................................................................................... 16 Db2 table columns............................................................................................................................... 20 Db2 indexes..........................................................................................................................................33 Db2 views...................................................................................................................................................34 Aliases........................................................................................................................................................ 36 Triggers.......................................................................................................................................................37 User-defined types.................................................................................................................................... 39 Routines..................................................................................................................................................... 40 Functions.............................................................................................................................................. 40 Procedures............................................................................................................................................40 Sequences..................................................................................................................................................41 Db2 system objects................................................................................................................................... 42 Db2 catalog...........................................................................................................................................42 Db2 directory........................................................................................................................................43 Active and archive logs.........................................................................................................................44 Bootstrap data set................................................................................................................................45 Buffer pools.......................................................................................................................................... 45 Data definition control support database............................................................................................46 The resource limit facility.....................................................................................................................46 Work file database................................................................................................................................46 Application processes and transactions..............................................................................................47 Subsystem parameters........................................................................................................................ 51 Storage structures..................................................................................................................................... 52 Db2 databases......................................................................................................................................52 Db2 table spaces..................................................................................................................................55 Db2 index spaces................................................................................................................................. 56 Rules for primary and secondary space allocation............................................................................. 56 Db2 hash spaces (deprecated)............................................................................................................ 58 iii Db2 storage groups.............................................................................................................................. 58 Accessing Db2 data................................................................................................................................... 59 Ways to select data from columns.......................................................................................................60 How a SELECT statement works..........................................................................................................63 SQL functions and expressions............................................................................................................64 Ways to filter the number of returned rows.........................................................................................70 Ways to order rows...............................................................................................................................78 Ways to summarize group values........................................................................................................ 80 Ways to merge lists of values...............................................................................................................81 Ways to specify search conditions.......................................................................................................82 Ways to join data from more than one table......................................................................................