- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Difference between Join and union in SQL
102 Lectures 7.5 hours
160 Lectures 21.5 hours
184 Lectures 22 hours
Union is a set operator that can be used to combine the result set of two different SELECT statement. In the union number of columns and data type should be the same.
It has two types −
- Union All
On the other hand ,In a Relational database, tables are associated with each other and we used foreign key to maintain relationships between tables. We used join clause to retrieve data from associated tables. The join condition indicates how column in each table are matched against each other.
There are two types of joins clause in SQL
- Inner join
- Outer join
It can be used to retrieve matched records between both tables or more tables
It can be used to combine the result set of two different SELECT statement.
Result set can have different types of data types
Data type should be same as the result set of each select statement
It doesn't remove duplicate data.
It removes duplicate rows between the various select statements.
Example of UNION
SELECT columnlist FROM tableA UNION SELECT columnlist FROM tableB
Example of JOIN
SELECT columnlist FROM TableA INNER JOIN TableB ON join condition
- Difference Between Inner Join and Outer Join in SQL
- Difference between Inner and Outer join in SQL
- Difference between UNION and UNION ALL in DB2
- Difference Between Structure and Union
- Difference between SQL and PL/SQL
- Difference Between SQL and T-SQL
- Difference between Static SQL and Dynamic SQL
- Difference Between T-SQL and PL-SQL
- Difference between Structure and Union in C
- Difference between SQL and NoSQL
- Difference between Structure and Union in C Program
- Difference between MySQL and SQL Server
- Difference between Oracle and SQL Server
- Difference between DELETE and DROP SQL
- Difference between SQL(Structured Query Language) and T-SQL(Transact-SQL).