SQL Views for Dummies - LISUGlisug.org/presentations/SQL_Views_for_Dummies.pdf · SQL Views for...

33
© 2017 IBM Corporation Cognitive Systems LISUG September 2017 SQL Views for Dummies Scott Forstie [email protected] @Forstie_IBMi Db2 for i Business Architect

Transcript of SQL Views for Dummies - LISUGlisug.org/presentations/SQL_Views_for_Dummies.pdf · SQL Views for...

Page 1: SQL Views for Dummies - LISUGlisug.org/presentations/SQL_Views_for_Dummies.pdf · SQL Views for Dummies Scott Forstie ... QSYS2.NETSTAT_ROUTE_INFO ...

© 2017 IBM Corporation

Cognitive Systems

LISUG – September 2017

SQL Views for Dummies

Scott Forstie – [email protected]@Forstie_IBMiDb2 for i Business Architect

Page 2: SQL Views for Dummies - LISUGlisug.org/presentations/SQL_Views_for_Dummies.pdf · SQL Views for Dummies Scott Forstie ... QSYS2.NETSTAT_ROUTE_INFO ...

© 2017 IBM Corporation

Cognitive Systems

LISUG – September 2017

SQL Views for Dummies

Scott Forstie – [email protected]@Forstie_IBMiDb2 for i Business Architect

Page 3: SQL Views for Dummies - LISUGlisug.org/presentations/SQL_Views_for_Dummies.pdf · SQL Views for Dummies Scott Forstie ... QSYS2.NETSTAT_ROUTE_INFO ...

© 2017 IBM Corporation

Cognitive Systems

LISUG – September 2017

Page 4: SQL Views for Dummies - LISUGlisug.org/presentations/SQL_Views_for_Dummies.pdf · SQL Views for Dummies Scott Forstie ... QSYS2.NETSTAT_ROUTE_INFO ...

© 2017 IBM Corporation

Cognitive Systems

LISUG – September 2017

Page 5: SQL Views for Dummies - LISUGlisug.org/presentations/SQL_Views_for_Dummies.pdf · SQL Views for Dummies Scott Forstie ... QSYS2.NETSTAT_ROUTE_INFO ...

© 2017 IBM Corporation

Cognitive Systems

LISUG – September 2017

• Keeping it simple

• Apply your deep knowledge using a different tool

• Think of new questions you’d like to have answered

• If you don’t use it, you lose it

How can SQL help you address these topics and more?

SQL Views for Dummies

Page 6: SQL Views for Dummies - LISUGlisug.org/presentations/SQL_Views_for_Dummies.pdf · SQL Views for Dummies Scott Forstie ... QSYS2.NETSTAT_ROUTE_INFO ...

© 2017 IBM Corporation

Cognitive Systems

LISUG – September 2017

• More powerful and feature rich

IBM i Access Client Solutions (ACS)

IBM i Access Windows Service Pack

Version 1.1.7.1

Run SQL Scripts and SQL Performance

Center, Visual Explain, Show Statements,

and much more…

Product Download Site:

http://www-03.ibm.com/systems/power/software/i/access/solutions.html

Next Planned Update… October 2017

Launch

IBM i Access Client Solutions – Run SQL Scripts

Page 7: SQL Views for Dummies - LISUGlisug.org/presentations/SQL_Views_for_Dummies.pdf · SQL Views for Dummies Scott Forstie ... QSYS2.NETSTAT_ROUTE_INFO ...

© 2017 IBM Corporation

Cognitive Systems

LISUG – September 2017

• QSYS2.USER_STORAGE is an alternative to the Display User Profile

(DSPUSRPRF) command

• It includes the ability to separate storage consumption by iASP

Query

---- description: User Storage – raw data --SELECT *

FROM qsys2.user_storage;

Page 8: SQL Views for Dummies - LISUGlisug.org/presentations/SQL_Views_for_Dummies.pdf · SQL Views for Dummies Scott Forstie ... QSYS2.NETSTAT_ROUTE_INFO ...

© 2017 IBM Corporation

Cognitive Systems

LISUG – September 2017

• You could either visit the documentation and copy each column name

listed in http://ibm.biz/DB2foriServices

or…

• Derive the column names

Columns

---- description: Find the column names for that service--SELECT COLUMN_NAME, C.*

FROM QSYS2.SYSCOLUMNS CWHERE TABLE_NAME = 'USER_STORAGE' AND

TABLE_SCHEMA = 'QSYS2'ORDER BY ORDINAL_POSITION;

Page 9: SQL Views for Dummies - LISUGlisug.org/presentations/SQL_Views_for_Dummies.pdf · SQL Views for Dummies Scott Forstie ... QSYS2.NETSTAT_ROUTE_INFO ...

© 2017 IBM Corporation

Cognitive Systems

LISUG – September 2017

• Make the query engine work for you!

Columns

---- description: Find the column names for that service--SELECT COLUMN_NAME CONCAT ', '

FROM QSYS2.SYSCOLUMNS CWHERE TABLE_NAME = 'USER_STORAGE' AND

TABLE_SCHEMA = 'QSYS2'ORDER BY ORDINAL_POSITION;

Page 10: SQL Views for Dummies - LISUGlisug.org/presentations/SQL_Views_for_Dummies.pdf · SQL Views for Dummies Scott Forstie ... QSYS2.NETSTAT_ROUTE_INFO ...

© 2017 IBM Corporation

Cognitive Systems

LISUG – September 2017

• Work smarter, not harder!

Columns

---- description: Find the column names for that service--SELECT LISTAGG(COLUMN_NAME, ', ')

WITHIN GROUP ( ORDER BY ORDINAL_POSITION )FROM QSYS2.SYSCOLUMNS CWHERE TABLE_NAME = 'USER_STORAGE' AND

TABLE_SCHEMA = 'QSYS2';

Page 11: SQL Views for Dummies - LISUGlisug.org/presentations/SQL_Views_for_Dummies.pdf · SQL Views for Dummies Scott Forstie ... QSYS2.NETSTAT_ROUTE_INFO ...

© 2017 IBM Corporation

Cognitive Systems

LISUG – September 2017

• QSYS2.USER_STORAGE is an alternative to the Display User Profile

(DSPUSRPRF) command

• It includes the ability to separate storage consumption by iASP

---- description: User Storage – raw data --SELECT *

FROM qsys2.user_storage;

Query

Page 12: SQL Views for Dummies - LISUGlisug.org/presentations/SQL_Views_for_Dummies.pdf · SQL Views for Dummies Scott Forstie ... QSYS2.NETSTAT_ROUTE_INFO ...

© 2017 IBM Corporation

Cognitive Systems

LISUG – September 2017

• Ordering can be ASC (ascending) or DESC (descending)

• More than one set of ordering criteria can be used

• The ordering criteria does not need to be in the select list

Ordering

---- description: User Storage – ordered--SELECT *

FROM qsys2.user_storageORDER BY stgused DESC;

Page 13: SQL Views for Dummies - LISUGlisug.org/presentations/SQL_Views_for_Dummies.pdf · SQL Views for Dummies Scott Forstie ... QSYS2.NETSTAT_ROUTE_INFO ...

© 2017 IBM Corporation

Cognitive Systems

LISUG – September 2017

• The fetch-first-clause sets a maximum number of rows returned

Fetch First N Rows Only

---- description: User Storage – Row control--SELECT *

FROM qsys2.user_storageORDER BY stgused DESCFETCH FIRST 10 ROWS ONLY;

Page 14: SQL Views for Dummies - LISUGlisug.org/presentations/SQL_Views_for_Dummies.pdf · SQL Views for Dummies Scott Forstie ... QSYS2.NETSTAT_ROUTE_INFO ...

© 2017 IBM Corporation

Cognitive Systems

LISUG – September 2017

• More recently, the LIMIT clause has been added for the same purpose

LIMIT

---- description: User Storage – Row control--SELECT *

FROM qsys2.user_storageORDER BY stgused DESCLIMIT 10;

Page 15: SQL Views for Dummies - LISUGlisug.org/presentations/SQL_Views_for_Dummies.pdf · SQL Views for Dummies Scott Forstie ... QSYS2.NETSTAT_ROUTE_INFO ...

© 2017 IBM Corporation

Cognitive Systems

LISUG – September 2017

• The WHERE clause is used to include or discard rows

• Predicates can be combined with AND, OR, parentheses and more

Predication

---- description: User Storage – Limiting results--SELECT *

FROM qsys2.user_storageWHERE user_name NOT LIKE 'Q%'ORDER BY stgused DESC LIMIT 10;

Page 16: SQL Views for Dummies - LISUGlisug.org/presentations/SQL_Views_for_Dummies.pdf · SQL Views for Dummies Scott Forstie ... QSYS2.NETSTAT_ROUTE_INFO ...

© 2017 IBM Corporation

Cognitive Systems

LISUG – September 2017

• Built-ins can be used in the select list to get the close to final form

• UPPER, LOWER, SUBSTR, and CONCAT are frequently used

Formatting

---- description: User Storage – Formatting results--SELECT user_name,aspgrp,

varchar_format(maxstg,'999,999,999,999,999,999,999') AS maximum_storage_kb,

varchar_format(stgused,'999,999,999,999,999,999,999') AS storage_kb

FROM qsys2.user_storage WHERE user_name NOT LIKE 'Q%'ORDER BY stgused DESC LIMIT 10;

Page 17: SQL Views for Dummies - LISUGlisug.org/presentations/SQL_Views_for_Dummies.pdf · SQL Views for Dummies Scott Forstie ... QSYS2.NETSTAT_ROUTE_INFO ...

© 2017 IBM Corporation

Cognitive Systems

LISUG – September 2017

• The GROUP BY clause consolidates like values into a single row

• Grouping expressions are frequently combined with COUNT(*) and SUM()

Grouping

---- description: User Storage – Grouping--SELECT user_name,varchar_format(SUM(stgused),'999,999,999,999,999,999,999')

AS storage_kbFROM qsys2.user_storage WHERE user_name NOT LIKE 'Q%'GROUP BY USER_NAME ORDER BY 2 DESC LIMIT 10;

Page 18: SQL Views for Dummies - LISUGlisug.org/presentations/SQL_Views_for_Dummies.pdf · SQL Views for Dummies Scott Forstie ... QSYS2.NETSTAT_ROUTE_INFO ...

© 2017 IBM Corporation

Cognitive Systems

LISUG – September 2017

• Enable Save Results in ACS

Saving to a spreadsheet

Page 19: SQL Views for Dummies - LISUGlisug.org/presentations/SQL_Views_for_Dummies.pdf · SQL Views for Dummies Scott Forstie ... QSYS2.NETSTAT_ROUTE_INFO ...

© 2017 IBM Corporation

Cognitive Systems

LISUG – September 2017

• Save Results… in ACS

Saving to a spreadsheet

Page 20: SQL Views for Dummies - LISUGlisug.org/presentations/SQL_Views_for_Dummies.pdf · SQL Views for Dummies Scott Forstie ... QSYS2.NETSTAT_ROUTE_INFO ...

© 2017 IBM Corporation

Cognitive Systems

LISUG – September 2017

• Save Results… in ACS

Saving to a Db2 for i file

Page 21: SQL Views for Dummies - LISUGlisug.org/presentations/SQL_Views_for_Dummies.pdf · SQL Views for Dummies Scott Forstie ... QSYS2.NETSTAT_ROUTE_INFO ...

© 2017 IBM Corporation

Cognitive Systems

LISUG – September 2017

• Avoid ACS completely with SQL

Create table

CREATE TABLE DBESTUDY.STORAGE_HOGS (SELECT user_name,varchar_format(SUM(stgused),'999,999,999,999,999,999,999')

AS storage_kbFROM qsys2.user_storage WHERE user_name NOT LIKE 'Q%'GROUP BY USER_NAME ORDER BY 2 DESC LIMIT 10

) WITH DATA;

Page 22: SQL Views for Dummies - LISUGlisug.org/presentations/SQL_Views_for_Dummies.pdf · SQL Views for Dummies Scott Forstie ... QSYS2.NETSTAT_ROUTE_INFO ...

© 2017 IBM Corporation

Cognitive Systems

LISUG – September 2017

SQLCL

Page 23: SQL Views for Dummies - LISUGlisug.org/presentations/SQL_Views_for_Dummies.pdf · SQL Views for Dummies Scott Forstie ... QSYS2.NETSTAT_ROUTE_INFO ...

© 2017 IBM Corporation

Cognitive Systems

LISUG – September 2017

SQLCL

Demo Time

Page 24: SQL Views for Dummies - LISUGlisug.org/presentations/SQL_Views_for_Dummies.pdf · SQL Views for Dummies Scott Forstie ... QSYS2.NETSTAT_ROUTE_INFO ...

© 2017 IBM Corporation

Cognitive Systems

LISUG – September 2017

2016

Services in 2015:

• MEMORY_POOL_INFO

• SYSTEM_STATUS_INFO

• LICENSE_INFO

• OBJECT_LOCK_INFO

• RECORD_LOCK_INFO

• MEDIA_LIBRARY_INFO

• GROUP_PTF_DETAILS

• NETSTAT_INFO

• NETSTAT_JOB_INFO

• NETSTAT_INTERFACE_INFO

• NETSTAT_ROUTE_INFO

• OUTPUT_QUEUE_ENTRIES

Services in 2016:

• HISTORY_LOG_INFO

• JOB_INFO

• OUTPUT_QUEUE_INFO

• ENVIRONMENT_VARIABLE_INFO

• AUTHORITY_COLLECTION

• Many enhanced services

7.2 – TR37.2 – TR57.3 – TR1 2017

7.2 – TR47.3 – GA

Services in 2017:

• AUTHORIZATION_LIST_INFO

• AUTHORIZATION_LIST_USER_INFO

• OBJECT_PRIVILEGES

• MESSAGE_QUEUE_INFO

• LICENSE_EXPIRATION_CHECK

• Enhanced USER_INFO

• Enhanced LICENSE_INFO

IBM i Services Timeline

7.2 – TR67.3 – TR2

http://ibm.biz/DB2foriServices

Page 25: SQL Views for Dummies - LISUGlisug.org/presentations/SQL_Views_for_Dummies.pdf · SQL Views for Dummies Scott Forstie ... QSYS2.NETSTAT_ROUTE_INFO ...

© 2017 IBM Corporation

Cognitive Systems

LISUG – September 2017

25

What is a Table Function?

A table function returns a table given a set of arguments.

Construct defined to SQL that returns rows of data that can be queried like a

permanent table (physical file).

Two types of table functions

- SQL

- External

Table functions can be used to apply SQL language processing power to data

that is not stored in the database or to allow access to such data as if it were

stored in a table. For example, a table function can read a file, get data from

the Web, or access a Lotus Notes® database and return a result table.

Page 26: SQL Views for Dummies - LISUGlisug.org/presentations/SQL_Views_for_Dummies.pdf · SQL Views for Dummies Scott Forstie ... QSYS2.NETSTAT_ROUTE_INFO ...

© 2017 IBM Corporation

Cognitive Systems

LISUG – September 2017 26

Db2 for i Published UDTFs

Application

‐ QSYS2.PARSE_STATEMENT()

Journal

‐ QSYS2.DISPLAY_JOURNAL()

Librarian

⁻ QSYS2.OBJECT_STATISTICS()

Message Handling

- QSYS2.HISTORY_LOG_INFO()

‐ QSYS2.JOBLOG_INFO()

Documented in the “Database Performance and Query Optimization” book

https://www.ibm.com/support/knowledgecenter/ssw_ibm_i_73/rzajq/rzajqservicessys.htm

Spool

⁻ QSYS2.OUTPUT_QUEUE_ENTRIES()

Work Management

‐ QSYS2.ACTIVE_JOB_INFO()

‐ QSYS2.GET_JOB_INFO()

‐ QSYS2.JOB_INFO()

‐ QSYS2.MEMORY_POOL()

‐ QSYS2.SYSTEM_STATUS()

Page 27: SQL Views for Dummies - LISUGlisug.org/presentations/SQL_Views_for_Dummies.pdf · SQL Views for Dummies Scott Forstie ... QSYS2.NETSTAT_ROUTE_INFO ...

© 2017 IBM Corporation

Cognitive Systems

LISUG – September 2017 27

Table Functions (UDTFs)

---- description: Find schemas that start with the letter M--SELECT * FROM TABLE

(qsys2.object_statistics('QSYS', 'LIB', '*ALL') ) AS x WHERE objname like 'M%'ORDER BY objcreated DESC;

SELECT * FROM qsys2.sysschemas WHERE system_schema_name like 'M%'ORDER BY creation_timestamp DESC;

• Many ways to get at the data

Page 28: SQL Views for Dummies - LISUGlisug.org/presentations/SQL_Views_for_Dummies.pdf · SQL Views for Dummies Scott Forstie ... QSYS2.NETSTAT_ROUTE_INFO ...

© 2017 IBM Corporation

Cognitive Systems

LISUG – September 2017 28

Table Functions (UDTFs)

---- description: Review statistics detail for a file--SELECT * FROM TABLE (qsys2.partition_statistics('TOYSTORE ', 'SALES ')) AS x;

SELECT * FROM qsys2.syspartitionstatWHERE table_schema = 'TOYSTORE' AND table_name = 'SALES';

• Many ways to get at the data

Page 29: SQL Views for Dummies - LISUGlisug.org/presentations/SQL_Views_for_Dummies.pdf · SQL Views for Dummies Scott Forstie ... QSYS2.NETSTAT_ROUTE_INFO ...

© 2017 IBM Corporation

Cognitive Systems

LISUG – September 201729

QSYS2.ASP_INFO

QSYS2.ASP_VARY_INFO

QSYS2.AUTHORITY_COLLECTION

QSYS2.COLUMN_STATISTICS

QSYS2.CONDENSE_ADVICE

QSYS2.DATABASE_MONITOR_INFORMATION

QSYS2.ENVIRONMENTAL_LIMITS

QSYS2.GETATLINFO

QSYS2.GETMLBST

QSYS2.GROUP_USERS

QSYS2.INDEX_PARTITION_STATISTICS

QSYS2.JOB_QUEUE_INFO

QSYS2.JVM_INFO

QSYS2.MESSAGE_QUEUE_INFO

QSYS2.MQT_PARTITION_STATISTICS

QSYS2.NS_GET4CJOB

QSYS2.GET4CSTS

QSYS2.NS_GET4ISTS

QSYS2.NS_GET4RINF

QSYS2.NS_GET6CJOB

QSYS2.NS_GET6CSTS

QSYS2.NS_GET6ISTS

QSYS2.NS_GET6RINF

QSYS2.OBJECT_LOCK_INFO

QSYS2.OBJECT_PRIVILEGES

QSYS2.OUTPUT_QUEUE_INFO

QSYS2.PACKAGE_STMT_STATISTICS

QSYS2.PARTITION_DISKS

QSYS2.PARTITION_INDEX_DISKS

QSYS2.PARTITION_STATISTICS

QSYS2.PRIVILEGES

QSYS2.PROGRAM_STATISTICS

QSYS2.PTF_INFO

QSYS2.QDBTS_TS_INDEX_INFO

QSYS2.QDBTS_TS_INDEX_NAME

QSYS2.QJORTVJI

QSYS2.QMPROFILES

QSYS2.QPM_QAPMCONF

QSYS2.QSQENVVAR

QSYS2.QSQJOBSCDE

QSYS2.QSQLCINF

QSYS2.QSQLIBL

QSYS2.QSQRPYLE

QSYS2.QSQSRVAUTE

QSYS2.QSQSYSCOL2

QSYS2.QSQSYSVAL

QSYS2.QSYFINFO

QSYS2.QSYFUSAGE

QSYS2.QSYUSRINFO

QSYS2.RECORD_LOCK_INFO

QSYS2.SCHEMAS

QSYS2.SERVER_SBS_ROUTING

QSYS2.SYSTMPSTG

QSYS2.TCPIP_INFO

QSYS2.USERS

Db2 for i Undocumented UDTFs

Page 30: SQL Views for Dummies - LISUGlisug.org/presentations/SQL_Views_for_Dummies.pdf · SQL Views for Dummies Scott Forstie ... QSYS2.NETSTAT_ROUTE_INFO ...

© 2017 IBM Corporation

Cognitive Systems

LISUG – September 2017

PTF Services

QSYS2.PTF_INFO – VIEW

QSYS2.GROUP_PTF_INFO – VIEW

SYSTOOLS.GROUP_PTF_CURRENCY – VIEW

SYSTOOLS.GROUP_PTF_DETAILS – VIEW

http://ibm.biz/DB2foriServices

http://www.ibm.com/developerworks/ibmi/techupdates/db2/landscape

Security Services

QSYS2.AUTHORIZATION_LIST_INFO – VIEW

QSYS2.AUTHORIZATION_LIST_USER_INFO – VIEW

QSYS2.DRDA_AUTHENTICATION_ENTRY_INFO – VIEW

QSYS2.FUNCTION_INFO – VIEW

QSYS2.FUNCTION_USAGE – VIEW

QSYS2.GROUP_PROFILE_ENTRIES – VIEW

QSYS2.OBJECT_PRIVILEGES – VIEW

QSYS2.SQL_CHECK_AUTHORITY – UDF

QSYS2.USER_INFO – VIEW

SYSPROC.SET_COLUMN_ATTRIBUTE – PROCEDURE

Communication Services

QSYS2.NETSTAT_INFO – VIEW

QSYS2.NETSTAT_INTERFACE_INFO – VIEW

QSYS2.NETSTAT_JOB_INFO – VIEW

QSYS2.NETSTAT_ROUTE_INFO – VIEW

QSYS2.SERVER_SBS_ROUTING – VIEW

QSYS2.SET_SERVER_SBS_ROUTING – PROCEDURE

QSYS2.TCPIP_INFO – VIEW

SYSIBMADM.ENV_SYS_INFO – VIEW

Work Management Services

QSYS2.ACTIVE_JOB_INFO – UDTF

QSYS2.GET_JOB_INFO – UDTF

QSYS2.JOB_INFO – UDTF

QSYS2.MEMORY_POOL – UDTF

QSYS2.MEMORY_POOL_INFO – VIEW

QSYS2.OBJECT_LOCK_INFO – VIEW

QSYS2.RECORD_LOCK_INFO – VIEW

QSYS2.SCHEDULED_JOB_INFO – VIEW

QSYS2.SYSTEM_STATUS – UDTF

QSYS2.SYSTEM_STATUS_INFO – VIEW

QSYS2.SYSTEM_VALUE_INFO – VIEW

System Health ServicesQSYS2.SYSLIMITS – VIEW

QSYS2.SYSLIMTBL – TABLE

Application Services

Journal ServicesQSYS2.DISPLAY_JOURNAL – UDTF

QSYS2.JOURNAL_INFO – VIEW

Storage Services

QSYS2.MEDIA_LIBRARY_INFO – VIEW

QSYS2.SYSDISKSTAT – VIEW

QSYS2.SYSTMPSTG – VIEW

QSYS2.USER_STORAGE – VIEW

IBM® i Services

QSYS2.QCMDEXC – PROCEDURE

QSYS2.ENVIRONMENT_VARIABLE_INFO – VIEW

QSYS2.SERVICES_INFO – TABLE

QSYS2.SET_PASE_SHELL_INFO – PROCEDURE

Librarian Services

QSYS2.LIBRARY_LIST_INFO – VIEW

QSYS2.OBJECT_STATISTICS – UDTF

Message Handling Services

QSYS2.HISTORY_LOG_INFO – UDTF

QSYS2.JOBLOG_INFO – UDTF

QSYS2.MESSAGE_QUEUE_INFO – VIEW

QSYS2.REPLY_LIST_INFO – VIEW

Java Services

QSYS2.JVM_INFO – VIEW

QSYS2.SET_JVM – PROCEDURE

IBM i Services

QSYS2.LICENSE_INFO – VIEW

SYSTOOLS.LICENSE_EXPIRATION_CHECK – PROCEDURE

QSYS2.OUTPUT_QUEUE_ENTRIES – VIEW

QSYS2.OUTPUT_QUEUE_ENTRIES – UDTF

QSYS2.OUTPUT_QUEUE_INFO – VIEW

Product Services

Spool Services

Page 31: SQL Views for Dummies - LISUGlisug.org/presentations/SQL_Views_for_Dummies.pdf · SQL Views for Dummies Scott Forstie ... QSYS2.NETSTAT_ROUTE_INFO ...

© 2017 IBM Corporation

Cognitive Systems

LISUG – September 2017

SYSCATALOGS

INFORMATION_SCHEMA_CATALOG_NAME

Catalogs

IBM® Db2® for i Catalogs

SQLSCHEMAS

SCHEMATA

Schemas

SYSSCHEMAS

SYSCHKCST

SYSCST

SYSCSTCOL

SYSCSTDEP

SYSKEYCST

SYSREFCST

SQLFOREIGNKEYS

SQLPRIMARYKEYS

CHECK_CONSTRAINTS

REFERENTIAL_CONSTRAINTS

TABLE_CONSTRAINTS

Constraints

SYSCOLUMNS

SYSCOLUMNS2

SYSFIELDS

SYSINDEXES

SYSKEYS

SYSTABLEDEP

SYSTABLES

SYSVIEWDEP

SYSVIEWS

SQLCOLUMNS

SQLSPECIALCOLUMNS

SQLTABLES

COLUMNS

TABLES

VIEWS

Tables Views Indexes

SYSTRIGCOL

SYSTRIGDEP

SYSTRIGGERS

SYSTRIGUPD

TriggersSYSPACKAGE

SYSSEQUENCES

SYSTYPES

SYSVARIABLEDEP

SYSVARIABLES

SQLTYPEINFO

SQLUDTS

USER_DEFINED_TYPES

SEQUENCES

Miscellaneous Objects

SYSFUNCS

SYSJARCONTENTS

SYSJAROBJECTS

SYSPARMS

SYSPROCS

SYSROUTINEDEP

SYSROUTINES

SQLFUNCTIONCOLS

SQLFUNCTIONS

SQLPROCEDURECOLS

SQLPROCEDURES

PARAMETERS

ROUTINES

Routines Statistics

SYSCOLUMNSTAT

SYSINDEXSTAT

SYSMQTSTAT

SYSPACKAGESTAT

SYSPACKAGESTMTSTAT

SYSPARTITIONDISK

SYSPARTITIONINDEXES

SYSPARTITIONINDEXDISK

SYSPARTITIONINDEXSTAT

SYSPARTITIONMQTS

SYSPARTITIONSTAT

SYSPROGRAMSTAT

SYSPROGRAMSTMTSTAT

SYSTABLEINDEXSTAT

SYSTABLESTAT

SQLSTATISTICS

Db2 for i catalog views (QSYS2)

ODBC and JDBCTM

catalog views (SYSIBM)

ANS and ISO catalog views (QSYS2)

SQL_FEATURES

SQL_LANGUAGES

SQL_SIZING

CHARACTER_SETS

Database Support

XSRANNOTATIONINFO

XSROBJECTCOMPONENTS

XSROBJECTHIERARCHIES

XSROBJECTS

XML Schemas

Privileges

SQLCOLPRIVILEGES

SQLTABLEPRIVILEGES

AUTHORIZATIONS

ROUTINE_PRIVILEGES

UDT_PRIVILEGES

USAGE_PRIVILEGES

VARIABLE_PRIVILEGES

SYSCOLAUTH

SYSCONTROLS

SYSCONTROLSDEP

SYSPACKAGEAUTH

SYSROUTINEAUTH

SYSSCHEMAAUTH

SYSSEQUENCEAUTH

SYSTABAUTH

SYSUDTAUTH

SYSVARIABLEAUTH

SYSXSROBJECTAUTH

Java is a registered trademark of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.

http://www.ibm.com/systems/i/software/db2/

Page 32: SQL Views for Dummies - LISUGlisug.org/presentations/SQL_Views_for_Dummies.pdf · SQL Views for Dummies Scott Forstie ... QSYS2.NETSTAT_ROUTE_INFO ...

© 2017 IBM Corporation

Cognitive Systems

LISUG – September 2017

QSYS2.CONDENSEDINDEXADVICE – VIEW

QSYS2.DATABASE_MONITOR_INFO – VIEW

QSYS2.RESET_TABLE_INDEX_STATISTICS – PROCEDURE

QSYS2.SYSIXADV – TABLE

SYSTOOLS.ACT_ON_INDEX_ADVICE – PROCEDURE

SYSTOOLS.HARVEST_INDEX_ADVICE – PROCEDURE

SYSTOOLS.REMOVE_INDEXES – PROCEDURE

Performance Services

QSYS2.HEALTH_ACTIVITY

QSYS2.HEALTH_DATABASE_OVERVIEW

QSYS2.HEALTH_DESIGN_LIMITS

QSYS2.HEALTH_ENVIRONMENTAL_LIMITS

QSYS2.HEALTH_SIZE_LIMITS

QSYS2.RESET_ENVIRONMENTAL_LIMITS

Health Center Procedures

http://www.ibm.com/developerworks/ibmi/techupdates/db2/landscape

QSYS2.CANCEL_SQL

QSYS2.DUMP_SQL_CURSORS

QSYS2.EXTRACT_STATEMENTS

QSYS2.FIND_AND_CANCEL_QSQSRVR_SQL

QSYS2.FIND_QSQSRVR_JOBS

QSYS2.GENERATE_SQL

QSYS2.RESTART_IDENTITY

SYSTOOLS.CHECK_SYSCST

SYSTOOLS.CHECK_SYSROUTINE

Utility Procedures

QSYS2.CHANGE_PLAN_CACHE_SIZE

QSYS2.CLEAR_PLAN_CACHE

QSYS2.DUMP_PLAN_CACHE

QSYS2.DUMP_PLAN_CACHE_PROPERTIES

QSYS2.DUMP_PLAN_CACHE_TOPN

QSYS2.DUMP_SNAP_SHOT_PROPERTIES

QSYS2.END_ALL_PLAN_CACHE_EVENT_MONITORS

QSYS2.END_PLAN_CACHE_EVENT_MONITOR

QSYS2.IMPORT_PC_EVENT_MONITOR

QSYS2.IMPORT_PC_SNAPSHOT

QSYS2.REMOVE_PC_EVENT_MONITOR

QSYS2.REMOVE_PC_SNAPSHOT

QSYS2.REMOVE_PERFORMANCE_MONITOR

QSYS2.START_PLAN_CACHE_EVENT_MONITOR

Plan Cache Procedures

QSYS2.DELIMIT_NAME – UDF

QSYS2.OVERRIDE_QAQQINI – PROCEDURE

QSYS2.OVERRIDE_TABLE – PROCEDURE

QSYS2.PARSE_STATEMENT – UDTF

SYSPROC.WLM_SET_CLIENT_INFO – PROCEDURE

Application Services

IBM® Db2® for i Services

Db2 for i Services

Page 33: SQL Views for Dummies - LISUGlisug.org/presentations/SQL_Views_for_Dummies.pdf · SQL Views for Dummies Scott Forstie ... QSYS2.NETSTAT_ROUTE_INFO ...

© 2017 IBM Corporation

Cognitive Systems

LISUG – September 2017

• 2,000+ Pages of fun!

• Updated twice per year

• Find the it here:

SQL Programmers Resource

http://ibm.biz/DB2fori_SQLreference