SQL UNION ALL - Overview, syntax

          

SQL UNION ALL


SQL UNION ALL - Introduction and syntax

<<Previous  Next>>

SQL - Dec 03, 2008 at 18:00 PM by Rajmeet Ghai

Explain the SQL UNION ALL statement. Write SQL syntax for the SQL UNION ALL statement along with an example.

SQL UNION ALL: The UNION ALL operator is used to combine the result-set of two or more SELECT statements Tables of both the select statement must have the same number of columns with similar data types. It lists ALL records.

Syntax:
SELECT column_name(s) FROM table_name1 UNION ALL SELECT column_name(s) FROM table_name2

Example:
SELECT emp_Name FROM Employees_india UNION ALL SELECT emp_Name FROM Employees_USA

SQL Union - May 18, 2009 at 10:00 AM by Rajmeet Ghai

What is the difference between UNION and UNION ALL?

UNION command selects distinct and related information from two tables. On the other hand, UNION ALL selects all the values from both the tables.


<<Previous  Next>>

Also read

What is RAID (Redundant Array of Inexpensive disks)? Explain its level.

RAID is a mechanism of storing the same data in different locations. Since the same data is stored, it is termed as redundant............   

Define transaction and transaction isolation levels.

Answer - A transaction is a set of operations that works as a single unit. The ransactions can be categorized into explicit, autocommit, and implicit....

SQL Server Optimization Tips

Answer - Restricting query result means return of required rows instead of all rows of the table. This helps in reducing network traffic......

Question: What is the purpose of SQL Profiler in SQL server?

Answer - SQL Profiler captures SQL Server events from a server. The events are saved.....

Question: What are the ways available in SQL Server to execute SQL statements?

Answer - SQL Server uses different ways to execute SQL statements which are listed below......

Question: What is the significance of NULL value and why should we avoid permitting null values?

Answer - Null means no entry has been made. It implies that the value is either unknown or undefined.....



Write your comment - Share Knowledge and Experience


 
Latest placement tests
Latest links
 
Latest MCQs
» General awareness - Banking » ASP.NET » PL/SQL » Mechanical Engineering
» IAS Prelims GS » Java » Programming Language » Electrical Engineering
» English » C++ » Software Engineering » Electronic Engineering
» Quantitative Aptitude » Oracle » English » Finance
Home | About us | Sitemap | Contact us | We are hiring