DB2 ⭐ Featured
👁 0

Q: Explain the difference between INNER JOIN and LEFT OUTER JOIN.

Answer:

INNER JOIN:

  • Returns only matching rows from both tables
  • If no match, row is excluded

LEFT OUTER JOIN:

  • Returns all rows from left table
  • Matching rows from right table
  • NULL for right table if no match
-- INNER JOIN
SELECT E.NAME, D.DEPT_NAME
FROM EMPLOYEE E
INNER JOIN DEPARTMENT D
ON E.DEPT_ID = D.DEPT_ID;

-- LEFT OUTER JOIN
SELECT E.NAME, D.DEPT_NAME
FROM EMPLOYEE E
LEFT OUTER JOIN DEPARTMENT D
ON E.DEPT_ID = D.DEPT_ID;

Use LEFT JOIN when you want all employees even those without department.

DB2 ⭐ Featured
👁 0

Q: What is the difference between INNER JOIN and LEFT OUTER JOIN?

Answer:
INNER JOIN returns only matching rows from both tables. LEFT OUTER JOIN returns all rows from left table plus matching rows from right (NULL if no match). LEFT preserves all left table rows regardless of match. INNER excludes non-matching rows from both sides.
COBOL
👁 0

Q: What are nested programs?

Answer:
Nested programs are contained within another COBOL program. Defined between IDENTIFICATION DIVISION and END PROGRAM. Can access outer program's data with GLOBAL clause. COMMON attribute allows access from sibling programs. Promotes modular design.