ORACLE
ORACLE OPERATORS
UNION
UNION ALL
INTERSECT
MINUS
ORACLE TUTORIAL
Oracle Introduction
What Is Oracle
Create Tables
What Is Oracle
ORACLE TABLES
Create Tables
Create Table As
Alter Table
Drop Table
Global Temorary Tables
Local Temorary Tables
ORACLE VIEWS
Create View
ORACLE QUERIES
SELECT
INSERT
INSERT
INSERT ALL
UPDATE
DELETE
TRUNCATE TABLE
ORACLE CLAUSES
DISTINCT
FROM
ORDER BY
GROUP BY
HAVING
ORACLE JOINS
INNER JOIN
OUTER JOIN
EQUI JOIN
SELF JOIN
CROSS JOIN
ANTI JOIN
SEMI JOIN
ORACLE ADVANCE
PROCEDURES
FUNCTION
CURSOR
TRIGGER

UNION ALL



Oracle - Union All


In Oracle, the UNION ALL operator is used to combine the result sets of 2 or more SELECT statements. It is different from UNION operator in a way that it does not remove duplicate rows between the various SELECT statements. It returns all of the rows.

Each SELECT statement within the UNION ALL must have the same number of fields in the result sets with similar data types.


Difference between UNION and UNION ALL operators :


In very simple words the difference between UNION and UNION ALL is that UNION will omit duplicate records whereas UNION ALL will include duplicate records.


Syntax :
SELECT expression1, expression2, ... expression_n  
FROM table1  
WHERE conditions  
UNION ALL  
SELECT expression1, expression2, ... expression_n  
FROM table2  
WHERE conditions;   

Parameters :


  • expression1, expression2, expression_n: It specifies the columns that you want to retrieve. Number of expressions must be same in both SELECT statements.

  • table1, table2: It specifies the table name that you want to retrieve records from.

  • conditions: It specifies the conditions that must be fulfilled for the records to be selected.


    Oracle UNION ALL Operator Example :


    SELECT supplier_id  
    FROM suppliers  
    UNION ALL  
    SELECT supplier_id  
    FROM order_details;  
    

    The above example will return the supplier_id multiple times in the result set if the same value appeared in both the supplier_id and order_details table.


    Output :

    Supplier_ID
    1
    2
    3
    50
    50
    21
    22
    25
    28
    20


    What Is Oracle

    What Is Oracle

    posted on 2019-11-29 01:11:21 - ORACLE Tutorials


    TRIGGER

    ORACLE - Trigger

    posted on 2019-11-28 22:14:22 - ORACLE Tutorials


    CURSOR

    ORACLE - Cursor

    posted on 2019-11-28 22:13:54 - ORACLE Tutorials


    Prompt Examples

    ChatGPT Prompt Examples

    posted on 2023-06-21 22:37:19 - ChatGPT Tutorials


    Use Cases

    Chat GPT Key Use Cases

    posted on 2023-06-21 21:03:17 - ChatGPT Tutorials


    Prompt Frameworks

    Prompt Frameworks

    posted on 2023-06-21 19:33:06 - ChatGPT Tutorials