Explain the SQL UNION statement. Write SQL syntax for the SQL UNION statement along with an example.
SQL
Syntax:
SELECT column_name(s) FROM table_name1 UNION SELECT column_name(s) FROM table_name2
Example:
SELECT emp_Name FROM Employees_india UNION SELECT emp_Name FROM Employees_USA
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.
No comments:
Post a Comment