
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 6705 Articles for Database

509 Views
The result of OUTER JOIN includes matched and unmatched rows in the WHERE clause. There are two main limitations of OUTER JOINS in DB2.The WHERE clause of OUTER JOIN can only have ‘=’ relational operator. , etc are not allowed in case of OUTER JOIN of two or more tables. Also two or more conditions in WHERE clause can only be used with AND logical operator, other logical operators such as OR, NOT is not allowed.The functions to handle NULL operators such as VALUE and COALESCE could not be used with the OUTER JOINS.For example, if we have below 2 ... Read More

749 Views
DB2 has a concept of DCL, through which we can control the access to DB2 objects like table, plan, etc. DCL stands for Data Control Language and using this we can provide and remove user access to the DB2 objects.GRANT command will give the user access to the mentioned object and REVOKE command will remove the user access.For example, if we have to provide SELECT and UPDATE access on the ORDERS table to user REL123X then we will fire below command.GRANT SELECT, UPDATE ON ORDERS TO REL123XIf we want to provide INSERT access, then we will use the below command.GRANT ... Read More

286 Views
DB2 places locks on the resources like table, tablespace, etc., when any application is using that resource. In a COBOL-DB2 program, if we are modifying or deleting data from a table then DB2 places locks. When we give the ROLLBACK statement to revert the changes made in the database, all the locks held by the DB2 are released by default.If we want to keep a lock on resources even after rollback, then we have to use ON ROLLBACK RETAIN LOCKS instead of ROLLBACK.For example, consider a cursor ORDER_CUR which is declared with FOR UPDATE OF clause. Therefore, as soon as ... Read More

3K+ Views
Problem: How to use SAVEPOINT in a DB2? What is the purpose of SAVE-POINT in DB2? Explain with the help of an example.SolutionThe SAVEPOINT is used as a marker or tag to save the changes without committing in the database. After making the changes in the database, we can give a named SAVEPOINT statement and after that at any point of time we can rollback the changes to this savepoint using ROLLBACK statement.Practically, we can have multiple SAVEPOINTS in our COBOL-DB2 program and we can jump back to any of these SAVEPOINTS using ROLLBACK. This will revert all changes made ... Read More

7K+ Views
The DB2 STORED PROCEDURE are the programs which are directly managed by DBMS. The STORED PROCEDURE generally contains SQLs and they can be called by application programs. The STORED PROCEDURE processes the query and returns the result to the application program. The STORED PROCEDURES can be used for the SQLs which are very often used, so instead of using the same SQL query again and again, we can simply use STORED PROCEDURE.The other benefit of STORED PROCEDURE is that they are fast and have good performance as compared to static SQLs used in application programs. The STORED PROCEDURE can be ... Read More

758 Views
The DB2 indexes are used to increase the query performance and speed up the query result. There can be multiple indexes built on a single table and DB2 optimizer chooses different indexes based on the predicate used in the WHERE clause to fetch the query result.In order to find out all the indexes which are built on a particular table we will use the DB2 system table SYSIBM.SYSINDEXES. This table records all the details related to indexes. Following SQL query can be used on this table to get the desired result.ExampleSELECT NAME, TBNAME FROM SYSIBM.SYSINDEXES WHERE TBNAME = ‘’The ... Read More

167 Views
A DB2 PLAN contains all the SQL statements in executable form. To execute any COBOL-DB2 program we need to provide its corresponding PLAN. The DB2 optimizer will evaluate the access path for the SQLs present in the PLAN to fetch the result for the COBOL-DB2 program. The SQLs in PLAN may use a number of indexes. Indexes facilitate the table search based on a key value and speed up the query processing time.If any of the index is dropped, it may negatively impact the PLANS which contain the SQLs using that dropped index. Therefore, as part of impact analysis, it ... Read More

720 Views
The DB2 SCALAR functions take a single column value and returns a single result. The COLUMN function takes the column value from multiple rows of a DB2 table and returns a single result. In case of SCALAR function only one row is involved.SCALAR FUNCTIONDESCRIPTIONLENGTHGives the length of the column valueREPLACEUsed to replace a string with another stringCONCATUsed to combine two or more column valuesINTEGERGives the integer equivalent of the column valueCHARGives the character equivalent of the column valueFor example, if we have an ORDERS DB2 table and we want to return only the integer value of the ORDER_TOTAL for all ... Read More

781 Views
The DB2 COLUMN functions are also known as aggregate functions. These functions take the values from a particular column of multiple rows and return a single value.Below is the list of some most commonly used COLUMN functions.COLUMN FUNCTIONDESCRIPTIONSUMFinds the sum of column valuesCOUNTCount the number of column valuesAVGFinds the average of column valuesMAXFinds the maximum value in the columnMINFinds the minimum value in the columnThe COLUMN function can only be used in the SELECT query. For example, if we have to find the average of all the ORDER_TOTAL for the orders placed on 15-08-2020 from the ORDERS table, then we ... Read More

2K+ Views
A DEADLOCK condition occurs when two applications lock the data that is needed by each other. Both the applications wait for the other one to release the lock and hence deadlock occurs.Let us see an example to understand this better:There are two COBOL-DB2 programs in execution: PROG A and PROG B.The PROG A is holding an UPDATE LOCK in ORDERS table while PROG B is holding a UPDATE LOCK in TRANSACTION table. At some point of time, PROG A requires an UPDATE LOCK on TRANSACTION TABLE and PROG B requires an UPDATE LOCK on ORDERS table but two application programs ... Read More