\documentclass[10pt,a4paper]{article} % Packages \usepackage{fancyhdr} % For header and footer \usepackage{multicol} % Allows multicols in tables \usepackage{tabularx} % Intelligent column widths \usepackage{tabulary} % Used in header and footer \usepackage{hhline} % Border under tables \usepackage{graphicx} % For images \usepackage{xcolor} % For hex colours %\usepackage[utf8x]{inputenc} % For unicode character support \usepackage[T1]{fontenc} % Without this we get weird character replacements \usepackage{colortbl} % For coloured tables \usepackage{setspace} % For line height \usepackage{lastpage} % Needed for total page number \usepackage{seqsplit} % Splits long words. %\usepackage{opensans} % Can't make this work so far. Shame. Would be lovely. \usepackage[normalem]{ulem} % For underlining links % Most of the following are not required for the majority % of cheat sheets but are needed for some symbol support. \usepackage{amsmath} % Symbols \usepackage{MnSymbol} % Symbols \usepackage{wasysym} % Symbols %\usepackage[english,german,french,spanish,italian]{babel} % Languages % Document Info \author{Andres Gomez Casanova (angoca)} \pdfinfo{ /Title (db2-cheat-sheet-for-development.pdf) /Creator (Cheatography) /Author (Andres Gomez Casanova (angoca)) /Subject (Db2 for Development Cheat Sheet) } % Lengths and widths \addtolength{\textwidth}{6cm} \addtolength{\textheight}{-1cm} \addtolength{\hoffset}{-3cm} \addtolength{\voffset}{-2cm} \setlength{\tabcolsep}{0.2cm} % Space between columns \setlength{\headsep}{-12pt} % Reduce space between header and content \setlength{\headheight}{85pt} % If less, LaTeX automatically increases it \renewcommand{\footrulewidth}{0pt} % Remove footer line \renewcommand{\headrulewidth}{0pt} % Remove header line \renewcommand{\seqinsert}{\ifmmode\allowbreak\else\-\fi} % Hyphens in seqsplit % This two commands together give roughly % the right line height in the tables \renewcommand{\arraystretch}{1.3} \onehalfspacing % Commands \newcommand{\SetRowColor}[1]{\noalign{\gdef\RowColorName{#1}}\rowcolor{\RowColorName}} % Shortcut for row colour \newcommand{\mymulticolumn}[3]{\multicolumn{#1}{>{\columncolor{\RowColorName}}#2}{#3}} % For coloured multi-cols \newcolumntype{x}[1]{>{\raggedright}p{#1}} % New column types for ragged-right paragraph columns \newcommand{\tn}{\tabularnewline} % Required as custom column type in use % Font and Colours \definecolor{HeadBackground}{HTML}{333333} \definecolor{FootBackground}{HTML}{666666} \definecolor{TextColor}{HTML}{333333} \definecolor{DarkBackground}{HTML}{00A305} \definecolor{LightBackground}{HTML}{F7FCF7} \renewcommand{\familydefault}{\sfdefault} \color{TextColor} % Header and Footer \pagestyle{fancy} \fancyhead{} % Set header to blank \fancyfoot{} % Set footer to blank \fancyhead[L]{ \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{C} \SetRowColor{DarkBackground} \vspace{-7pt} {\parbox{\dimexpr\textwidth-2\fboxsep\relax}{\noindent \hspace*{-6pt}\includegraphics[width=5.8cm]{/web/www.cheatography.com/public/images/cheatography_logo.pdf}} } \end{tabulary} \columnbreak \begin{tabulary}{11cm}{L} \vspace{-2pt}\large{\bf{\textcolor{DarkBackground}{\textrm{Db2 for Development Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{Andres Gomez Casanova (angoca)} via \textcolor{DarkBackground}{\uline{cheatography.com/73273/cs/18485/}}} \end{tabulary} \end{multicols}} \fancyfoot[L]{ \footnotesize \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{LL} \SetRowColor{FootBackground} \mymulticolumn{2}{p{5.377cm}}{\bf\textcolor{white}{Cheatographer}} \\ \vspace{-2pt}Andres Gomez Casanova (angoca) \\ \uline{cheatography.com/angoca} \\ \uline{\seqsplit{angoca}.users.sf.net} \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Cheat Sheet}} \\ \vspace{-2pt}Published 8th January, 2019.\\ Updated 6th August, 2019.\\ Page {\thepage} of \pageref{LastPage}. \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Sponsor}} \\ \SetRowColor{white} \vspace{-5pt} %\includegraphics[width=48px,height=48px]{dave.jpeg} Measure your website readability!\\ www.readability-score.com \end{tabulary} \end{multicols}} \begin{document} \raggedright \raggedcolumns % Set font size to small. Switch to any value % from this page to resize cheat sheet text: % www.emerson.emory.edu/services/latex/latex_169.html \footnotesize % Small font. \begin{multicols*}{3} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Db2 logo}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{p{5.377cm}}{\vspace{1px}\centerline{\includegraphics[width=5.1cm]{/web/www.cheatography.com/public/uploads/angoca_1546921030_download.png}}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{General}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{Execution of a file in the console (db2clp) \newline % Row Count 1 (+ 1) \{\{fa-angle-right\}\} Semi-colon separated sentences: \newline % Row Count 3 (+ 2) `db2 -t` \newline % Row Count 4 (+ 1) \{\{fa-angle-right\}\} At sign separated sentences (when there is SQL PL code): \newline % Row Count 6 (+ 2) `db2 -td@` \newline % Row Count 7 (+ 1) Define a terminator character \newline % Row Count 8 (+ 1) `-{}-\#SET TERMINATOR @` \newline % Row Count 9 (+ 1) List all databases (aliases) \newline % Row Count 10 (+ 1) `LIST DB DIRECTORY` \newline % Row Count 11 (+ 1) Connect to a database (alias) \newline % Row Count 12 (+ 1) `CONNECT TO mydb` \newline % Row Count 13 (+ 1) Disconnect from a database \newline % Row Count 14 (+ 1) `CONNECT RESET` \newline % Row Count 15 (+ 1) `TERMINATE` \newline % Row Count 16 (+ 1) Get values from the environment (registry values) \newline % Row Count 17 (+ 1) * Current timestamp \newline % Row Count 18 (+ 1) `VALUES CURRENT TIMESTAMP` \newline % Row Count 19 (+ 1) \{\{fa-angle-right\}\} Connected user \newline % Row Count 20 (+ 1) `VALUES CURRENT USER` \newline % Row Count 21 (+ 1) \{\{fa-angle-right\}\} Current database \newline % Row Count 22 (+ 1) `VALUES CURRENT SERVER` \newline % Row Count 23 (+ 1) List all tables \newline % Row Count 24 (+ 1) `LIST TABLES` \newline % Row Count 25 (+ 1) `LIST TABLES FOR SCHEMA myuser` \newline % Row Count 26 (+ 1) `LIST TABLES FOR ALL` \newline % Row Count 27 (+ 1) Change current schema \newline % Row Count 28 (+ 1) `SET CURRENT SCHEMA otherschema` \newline % Row Count 29 (+ 1) Change the isolation level \newline % Row Count 30 (+ 1) } \tn \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{General (cont)}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{`SET ISOLATION RR` \newline % Row Count 1 (+ 1) List all tablespaces with their status \newline % Row Count 2 (+ 1) `LIST TABLESPACES` \newline % Row Count 3 (+ 1) Describe the estructure of the table \newline % Row Count 4 (+ 1) `DESCRIBE TABLE mytable` \newline % Row Count 5 (+ 1) Describe the result of a query \newline % Row Count 6 (+ 1) `DESCRIBE SELECT * FROM mytable` \newline % Row Count 7 (+ 1) Get help for a Db2 command \newline % Row Count 8 (+ 1) `? command` \newline % Row Count 9 (+ 1) Get help for a SQL code (SQLXXXX) or SQLstate (YYYYY) \newline % Row Count 11 (+ 2) `? SQLXXX` \newline % Row Count 12 (+ 1) `? YYYYY`% Row Count 13 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{DCL}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{Grant on a table \newline % Row Count 1 (+ 1) `GRANT SELECT, INSERT ON TABLE tbl1 TO user` \newline % Row Count 2 (+ 1) Grant execution on a stored procedure \newline % Row Count 3 (+ 1) `GRANT EXECUTE ON PROCEDURE prc1(INT, DATE) TO USER jdoe` \newline % Row Count 5 (+ 2) `GRANT EXECUTE ON SPECIFIC PROCEDURE mypr TO GROUP admins` \newline % Row Count 7 (+ 2) Revoke on a table \newline % Row Count 8 (+ 1) `REVOKE DELETE ON TABLE mytable FROM recur`% Row Count 9 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Source}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{Created by: Andres Gomez Casanova (\{\{link="https://twitter.com/angoca"\}\}@angoca\{\{/link\}\}) \newline % Row Count 2 (+ 2) Version: 2019-08-04 \newline % Row Count 3 (+ 1) Get the most recent version at \newline % Row Count 4 (+ 1) \{\{link="https://github.com/angoca/db2-cheat-sheet/"\}\}https://github.com/angoca/db2-cheat-sheet/\{\{/link\}\}% Row Count 7 (+ 3) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{License}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{This work is licensed under a \{\{link="http://creativecommons.org/licenses/by-sa/4.0/"\}\}Creative Commons Attribution-ShareAlike 4.0 International License.\{\{/link\}\}% Row Count 4 (+ 4) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{DDL}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{Create a schema \newline % Row Count 1 (+ 1) `CREATE SCHEMA sch1` \newline % Row Count 2 (+ 1) Create a table specifying primary key \newline % Row Count 3 (+ 1) `CREATE TABLE tbl1 (col1 CHAR(1) NOT NULL PRIMARY KEY)` \newline % Row Count 5 (+ 2) `CREATE TABLE tbl2 (col1 INT NOT NULL, col2 DATE NOT NULL, PRIMARY KEY (col1, col2))` \newline % Row Count 7 (+ 2) Create a table specifying tablespaces \newline % Row Count 8 (+ 1) `CREATE TABLE tbl3 (col1 INT NOT NULL, col2 CHAR(1)) IN ts1 INDEX IN ts2` \newline % Row Count 10 (+ 2) Create a table specifying schema \newline % Row Count 11 (+ 1) `CREATE TABLE sch1.tbl4 (col1 INT)` \newline % Row Count 12 (+ 1) Create a table with auto incremental column \newline % Row Count 13 (+ 1) `CREATE TABLE tbl5 (col1 INT NOT NULL GENERATED AS IDENTITY)` \newline % Row Count 15 (+ 2) Create a table like another one \newline % Row Count 16 (+ 1) `CREATE TABLE tbl6 LIKE tbl1 IN ts1 INDEX IN ts2` \newline % Row Count 17 (+ 1) Comment on table and column \newline % Row Count 18 (+ 1) `COMMENT ON TABLE tbl1 IS 'Comment in table'` \newline % Row Count 19 (+ 1) `COMMENT ON COLUMN tbl1.col1 IS 'Description of the field'` \newline % Row Count 21 (+ 2) Declare a temporary table (session schema) \newline % Row Count 22 (+ 1) `DECLARE GLOBAL TEMPORARY TABLE tmp1 (col1 INT, col2 DATE) ON COMMIT PRESERVE ROWS` \newline % Row Count 24 (+ 2) Create a global temporary tablespace \newline % Row Count 25 (+ 1) `CREATE GLOBAL TEMPORARY TABLE tmp2 (col1 INT)` \newline % Row Count 26 (+ 1) Create an index \newline % Row Count 27 (+ 1) `CREATE INDEX idx1 ON tbl2 (col2)` \newline % Row Count 28 (+ 1) Create a unique index \newline % Row Count 29 (+ 1) `CREATE UNIQUE INDEX idx2 ON tbl5 (col1)` \newline % Row Count 30 (+ 1) } \tn \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{DDL (cont)}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{Drop an index \newline % Row Count 1 (+ 1) `DROP INDEX idx1` \newline % Row Count 2 (+ 1) Add a column (requires Reorg table) \newline % Row Count 3 (+ 1) `ALTER TABLE tbl1 ADD COLUMN col3 timestamp` \newline % Row Count 4 (+ 1) Change nullability \newline % Row Count 5 (+ 1) `ALTER TABLE tbl1 ALTER COLUMN col3 SET NOT NULL` \newline % Row Count 6 (+ 1) Drop nullability \newline % Row Count 7 (+ 1) `ALTER TABLE tbl1 ALTER COLUMN col3 DROP NOT NULL` \newline % Row Count 9 (+ 2) Rename a column \newline % Row Count 10 (+ 1) `ALTER TABLE tbl1 RENAME COLUMN col3 TO new3` \newline % Row Count 11 (+ 1) Drop column \newline % Row Count 12 (+ 1) `ALTER TABLE tbl1 DROP COLUMN new3` \newline % Row Count 13 (+ 1) Create a primary key constraint \newline % Row Count 14 (+ 1) `ALTER TABLE tbl5 ADD CONSTRAINT pkt5 PRIMARY KEY (col1)` \newline % Row Count 16 (+ 2) Drop primary key \newline % Row Count 17 (+ 1) `ALTER TABLE tbl5 DROP PRIMARY KEY` \newline % Row Count 18 (+ 1) Add identity \newline % Row Count 19 (+ 1) `ALTER TABLE tbl2 ALTER col1 SET GENERATED ALWAYS AS IDENTITY` \newline % Row Count 21 (+ 2) Restart identity \newline % Row Count 22 (+ 1) `ALTER TABLE tbl2 ALTER col1 RESTART WITH 1` \newline % Row Count 23 (+ 1) Drop identity \newline % Row Count 24 (+ 1) `ALTER TABLE tbl2 ALTER col1 DROP IDENTITY` \newline % Row Count 25 (+ 1) Create a foreign key \newline % Row Count 26 (+ 1) `ALTER TABLE tbl5 ADD CONSTRAINT fkt5 FOREIGN KEY (col1) REFERENCES tbl11 (col1)` \newline % Row Count 28 (+ 2) Create a check constraint \newline % Row Count 29 (+ 1) `ALTER TABLE tbl1 ADD CONSTRAINT chk CHECK (col1 in ('a', 'b', 'c'))` \newline % Row Count 31 (+ 2) } \tn \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{DDL (cont)}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{Enforce a constraint \newline % Row Count 1 (+ 1) `ALTER TABLE tbl1 ALTER CHECK chk ENFORCED` \newline % Row Count 2 (+ 1) Not enforce a constraint \newline % Row Count 3 (+ 1) `ALTER TABLE tbl5 ALTER FOREIGN KEY fkt5 NOT ENFORCED` \newline % Row Count 5 (+ 2) Change the granularity of the locks \newline % Row Count 6 (+ 1) `ALTER TABLE tbl1 LOCKSIZE TABLE` \newline % Row Count 7 (+ 1) Drop a table \newline % Row Count 8 (+ 1) `DROP TABLE tbl1` \newline % Row Count 9 (+ 1) Rename a table \newline % Row Count 10 (+ 1) `RENAME TABLE tbl2 TO table2` \newline % Row Count 11 (+ 1) Truncate a table \newline % Row Count 12 (+ 1) `TRUNCATE TABLE tbl1 IMMEDIATE` \newline % Row Count 13 (+ 1) Create a sequence \newline % Row Count 14 (+ 1) `CREATE SEQUENCE seq AS INTEGER` \newline % Row Count 15 (+ 1) Restart sequence \newline % Row Count 16 (+ 1) `ALTER SEQUENCE seq RESTART WITH 15` \newline % Row Count 17 (+ 1) Create a stored procedure \newline % Row Count 18 (+ 1) `CREATE OR REPLACE PROCEDURE prc1 (IN val INT, OUT ret DATE) SPECIFIC mypr BEGIN SET ret = (SELECT col2 FROM tbl2 WHERE col1 = val); END @` \newline % Row Count 21 (+ 3) Create a trigger \newline % Row Count 22 (+ 1) `CREATE TRIGGER cp\_val AFTER INSERT ON tbl1 REFERENCING NEW AS n FOR EACH ROW INSERT INTO tbl2 VALUES (n.col1, n.col2)` \newline % Row Count 25 (+ 3) Create a view \newline % Row Count 26 (+ 1) `CREATE VIEW vw1 AS SELECT col2 FROM tbl1`% Row Count 27 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{DML}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{Insert values on a table \newline % Row Count 1 (+ 1) `INSERT INTO tbl3 VALUES (2, 'b')` \newline % Row Count 2 (+ 1) `INSERT INTO tbl3 VALUES (3, 'c'), (4, 'd'), (5, 'e') -{}-Atomic` \newline % Row Count 4 (+ 2) Insert certain columns \newline % Row Count 5 (+ 1) `INSERT INTO tbl1 (col1) VALUES (6)` \newline % Row Count 6 (+ 1) Insert values from a select \newline % Row Count 7 (+ 1) `INSERT INTO tbl6 SELECT col1 FROM tbl1` \newline % Row Count 8 (+ 1) Insert in temporary table \newline % Row Count 9 (+ 1) `INSERT INTO session.tmp1 VALUES (1)` \newline % Row Count 10 (+ 1) Update fields \newline % Row Count 11 (+ 1) `UPDATE tbl3 SET col1 = 5, mycol2 = 'e' -–all table` \newline % Row Count 13 (+ 2) `UPDATE tbl3 SET col2 = 'd' WHERE col1 = 7` \newline % Row Count 14 (+ 1) Merge (upsert) \newline % Row Count 15 (+ 1) `MERGE INTO tbl3 AS t USING (SELECT col1 FROM tbl1) s ON (t.col1 = s.col1) WHEN MATCHED THEN UPDATE SET col2 = 'X' WHEN NOT MATCHED THEN INSERT VALUES (10, 'X')` \newline % Row Count 19 (+ 4) Delete rows \newline % Row Count 20 (+ 1) `DELETE FROM tbl1 -–all table` \newline % Row Count 21 (+ 1) `DELETE FROM tbl1 WHERE col1 \textgreater{} 5` \newline % Row Count 22 (+ 1) Export \newline % Row Count 23 (+ 1) `EXPORT TO myfile OF DEL SELECT * FROM tbl1` \newline % Row Count 24 (+ 1) Import \newline % Row Count 25 (+ 1) `IMPORT FROM myfile OF DEL INSERT INTO mytable1` \newline % Row Count 26 (+ 1) Cursor \newline % Row Count 27 (+ 1) `DECLARE cur1 CURSOR FOR SELECT * FROM tbl1` \newline % Row Count 28 (+ 1) Load \newline % Row Count 29 (+ 1) `LOAD FROM myfile OF DEL INSERT INTO tbl1` \newline % Row Count 30 (+ 1) } \tn \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{DML (cont)}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{`LOAD FROM cur1 OF CURSOR INSERT INTO tbl1` \newline % Row Count 1 (+ 1) Query the status of the load in a table \newline % Row Count 2 (+ 1) `LOAD QUERY TABLE tbl1` \newline % Row Count 3 (+ 1) Set integrity \newline % Row Count 4 (+ 1) `SET INTEGRITY FOR tbl1 IMMEDIATE CHECKED` \newline % Row Count 5 (+ 1) Ingest \newline % Row Count 6 (+ 1) `INGEST FROM FILE myfile FORMAT DELIMITED INSERT INTO tbl1` \newline % Row Count 8 (+ 2) Get the next value from a sequence \newline % Row Count 9 (+ 1) `VALUES NEXT VALUE FOR seq` \newline % Row Count 10 (+ 1) `INSERT INTO tbl3 (col1) VALUES (NEXT VALUE FOR seq)`% Row Count 12 (+ 2) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Queries}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{Put a lock at table level \newline % Row Count 1 (+ 1) `LOCK TABLE tbl1 IN EXCLUSIVE MODE` \newline % Row Count 2 (+ 1) Execute a query without regard of commit rows \newline % Row Count 3 (+ 1) `SELECT * FROM tbl1 WITH UR -{}-RR,RS,CS` \newline % Row Count 4 (+ 1) Execute a query with only 5 rows \newline % Row Count 5 (+ 1) `SELECT * FROM tbl1 FETCH FIRST 5 ROWS ONLY` \newline % Row Count 6 (+ 1) Perform a query to a dummy table (dual) \newline % Row Count 7 (+ 1) `SELECT 'Any string' FROM SYSIBM.SYSDUMMY1` \newline % Row Count 8 (+ 1) Perform a query calling a function \newline % Row Count 9 (+ 1) `SELECT HEX(col2) FROM tbl5` \newline % Row Count 10 (+ 1) Call a function \newline % Row Count 11 (+ 1) `VALUES HEX('AnyText')` \newline % Row Count 12 (+ 1) Perform a cast \newline % Row Count 13 (+ 1) `VALUES CAST('123' AS INTEGER)` \newline % Row Count 14 (+ 1) Concatenate \newline % Row Count 15 (+ 1) `VALUES 'AnyText' || 5` \newline % Row Count 16 (+ 1) `VALUES 'AnyText' concat 5` \newline % Row Count 17 (+ 1) Escape a single quote in a text field \newline % Row Count 18 (+ 1) `VALUES 'Sinead o''Connor'` \newline % Row Count 19 (+ 1) Query the database catalog \newline % Row Count 20 (+ 1) `SELECT * FROM SYSCAT.TABLES` \newline % Row Count 21 (+ 1) `SELECT * FROM SYSCAT.TABAUTH` \newline % Row Count 22 (+ 1) `SELECT * FROM SYSCAT.ROUTINES`% Row Count 23 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{TCL}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{Commit changes \newline % Row Count 1 (+ 1) `COMMIT` \newline % Row Count 2 (+ 1) Create a savepoint \newline % Row Count 3 (+ 1) `SAVEPOINT sp1 ON ROLLBACK RETAIN CURSORS` \newline % Row Count 4 (+ 1) Undo changes until savepoint \newline % Row Count 5 (+ 1) `ROLLBACK TO SAVEPOINT sp1` \newline % Row Count 6 (+ 1) Undo changes \newline % Row Count 7 (+ 1) `ROLLBACK`% Row Count 8 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} % That's all folks \end{multicols*} \end{document}