Iseries SQL
DB2 SQL DB GENERATED SEQUENCE : BASIC
Let say you add a column ID in your table and you want an incremented value for this column every time a new record is inserted in Table or later you want to re-sequence the same ID column starting from 1. There can be multiple tricks to achieve this but SQL provides multiple very simple and handy option to do all these tasks where a [...]
DB2 SQL JOINS : CROSS JOIN
SQL CROSS JOIN returns every possible combination of rows from the every table being joined(This is also called Cartesian product).
DB2 SQL JOINS : EXCEPTION JOIN
Here is how SQL EXCEPTION JOIN works. It returns rows from PRIMARY table that don’t have a match in any of SECONDARY table. Columns that come from SECONDARY table(s) will always have null value.
DB2 SQL JOINS : OUTER JOIN
SQL OUTER Join gives All data from PRIMARY table with matching date from SECONDARY table(s) appended to it. If no matching data found in SECONDARY table(s) for join condition NULL value will be used to fill that space.
DB2 SQL JOINS : INNER JOIN
INNER Join returns records which are common in all tables based on given join condition. There are two ways to write INNER Join:[SAMPLE DATA]
DB2 SQL JOINS : BASIC
SQL JOINS allow you to combine records for multiple tables based on some condition. This condition in most cases is “common value(s)” between tables needed to join. But there are options of more conditions. If you have worked on DB2 JOIN LOGICAL FILE it has almost same concept as SQL JOINS but SQL JOINS give you more options [...]
DB2 SQL 103 DML : DELETE and TRUNCATE
SQL DELETE is quite straightforward. DELETE FROM TABLENAME WHERE COLUMN1='X' and COLUMN2='Y'
DB2 SQL 103 DML : UPDATE
DB2 SQL has given 2 options for SQL UPDATE statement: UPDATE using individual value UPDATE EMPLOYEE SET WORKDEPT = ’D11’, PHONENO = ’7213’, JOB = ’DESIGNER’ WHERE EMPNO = ’000270’
DB2 SQL 103 DML : INSERT
SQL provides INSERT statement to append new data in DB Table. There are multiple ways to use SQL INSERT:
DB2 SQL 103 DML : SELECT
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 table or create a new table based on the result set of query.
DB2 SQL 102 DDL : DROP TABLE
DROP TABLE statement is very simple and straightforward. DROP TABLE <table_name>
DB2 SQL 102 DDL : ALTER TABLE
SQL ALTER TABLE statement gives options to change almost every thing in TABLE structure. Like Add, Drop or Change definition of column(s). The altered table may consist up to 8000 columns.
DB2 SQL 102 DDL : CREATE TABLE
SQL Data Definition Language(DDL) works around the definition of Data. In simple word DDL is about create, delete, and alter SQL Tables. Create Table DB2 SQL provide 3 ways to use CREATE TABLE Statement.
DB2 SQL 101 Basic
Structured Query Language aka SQL is industry standard to talk to Relation database management systems (RDBMS). RDBMS and SQL are like alias to each other. To perform any action on RDBMS you need SQL.