TheDeveloperBlog.com

Home | Contact Us

C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML

Oracle Union All

Oracle Union All for beginners and professionals with examples on insert, select, update, delete, table, view, join, key, functions, procedures, indexes, cursor etc.

<< Back to ORACLE

Oracle UNION ALL Operator

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

UNION operator removes duplicate rows while UNION ALL operator does not remove duplicate rows.

Syntax

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

Parameters

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

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

3) 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

Oracle Union All 1



Related Links:


Related Links

Adjectives Ado Ai Android Angular Antonyms Apache Articles Asp Autocad Automata Aws Azure Basic Binary Bitcoin Blockchain C Cassandra Change Coa Computer Control Cpp Create Creating C-Sharp Cyber Daa Data Dbms Deletion Devops Difference Discrete Es6 Ethical Examples Features Firebase Flutter Fs Git Go Hbase History Hive Hiveql How Html Idioms Insertion Installing Ios Java Joomla Js Kafka Kali Laravel Logical Machine Matlab Matrix Mongodb Mysql One Opencv Oracle Ordering Os Pandas Php Pig Pl Postgresql Powershell Prepositions Program Python React Ruby Scala Selecting Selenium Sentence Seo Sharepoint Software Spellings Spotting Spring Sql Sqlite Sqoop Svn Swift Synonyms Talend Testng Types Uml Unity Vbnet Verbal Webdriver What Wpf