DECLARE GLOBAL TEMPORARY TABLE gives you a handy option to create a table in QTEMP lib with some handy options.


SELECT Statement

SQL SELECT Statement is a form of SQL QUERY which gives access to a result set(Temporary table). We can use SQL SELECT to look inside the table or create a new table based on the result set of queries.

There are 3 components of SQL SELECT:

SubSelect

SubSelect…

Structured Query Language aka SQL is the industry standard to talk to Relation database management systems (RDBMS). RDBMS and SQL are like an alias to each other. To perform any action on RDBMS you need SQL.

All the basic concepts of SQL are the same for every RDBMS like SQLServer…


When processing a CURSOR, DB2 SQL gives the option to update or delete data in the base table based on CURSOR's current position in the result table. This is called POSITIONED UPDATE or POSITIONED DELETE.

Let say there is a table EXAMPLETABLE like

CREATE TABLE EXAMPLETABLE (id numeric, name char(10)…


The result of a SELECT Statement which returns more than one row, is easy to view on an SQL interface like STRSQL. But How can we handle this result set pragmatically in Embedded SQL or SQL/PL code?

The answer is SQL CURSOR.

CURSOR provides a simple way to access Result…


GLOBAL VARIABLES


We can use a very simple correlated query to find the nth highest or lowest record in a table.

Here is the query to find 2nd highest salary from the…


There are two ways to write SQL: Static SQL, which gets the job done in most cases, and the second one is Dynamic SQL for the rest of the complex stuff.

Static SQL


Materialized Query Table(MQT)

Syntax for MQT

CREATE TABLE mqt-name…

There are multiple ways to Delete duplicate data from A Table using SQL Query. Here we are going to talk about using Correlated subqueries to Delete duplicate data.

Let say we have an EMPLOYEE table as follows.

In the above EMPLOYEE table, multiple records are duplicates. To remove all duplicate…

Sumit goyal

A programmer.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store