- Trending Categories
- Data Structure
- Operating System
- MS Excel
- C Programming
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Example and usage of JOINS in DB2
Problem: How will you find the ORDER_ID, TRANSACTION_ID and TRANSACTION_STATUS from ORDERS and TRANSACTIONS DB2 table using joins?
We can find ORDER_ID, TRANSACTION_ID and TRANSACTION_STATUS from ORDERS and TRANSACTIONS table using the INNER JOIN query.
For example, if we have below 2 ORDERS table.
We can use an inner join query as below.
SELECT ORDER_ID, TRANSACTION_ID, TRANSACTION_STATUS FROM ORDERS INNER JOIN TRANSACTIONS ON ORDERS.TRANSACTION_ID = TRANSACTIONS.TRANSACTION_ID
The above query will return the result below.
- Related Articles
- Usage and example of Multi-index and Index-only access path in DB2
- Purpose and usage of SAVEPOINT in COBOL-DB2 program
- Usage and syntax of INNER and OUTER JOIN in DB2
- Purpose and usage of ROW-ID and SEQUENCE in a DB2
- Error codes, cause and example of deadlock in DB2
- What is the definition and usage of alternate key in a DB2 table?
- What is the usage and purpose of DCLGEN and host variables used in COBOL-DB2 program
- What is the purpose and usage of “WHERE CURRENT OF” clause in a COBOL-DB2 program?
- What is the purpose and usage of “FOR UPDATE OF” clause in a COBOL-DB2 program
- What is the purpose and usage of SQLCODE within the SQLCA in a COBOL-DB2 program
- Purpose and usage of subqueries in DB with the help of an example
- Explain the concept of DYNAMIC SQL in DB2 with the help of an example
- What is CLUSTERED INDEX in DB2? Explain with the help of practical example.
- What are COLUMN functions in DB2? Explain with the help of an example
- What is NON CLUSTERED INDEX in DB2? Explain with the help of practical example