LTIMindtree interview question

Difference between join and union.

Interview Answer

Anonymous

28 May 2025

Join - Horizontal combination - sticking tables together side-by-side union - Vertical Combination - stacking tables on top of each other. SELECT Customers.CustomerID, Customers.CustomerName, Orders.OrderID, Orders.OrderDate FROM Customers INNER JOIN Orders ON Customers.CustomerID = Orders.CustomerID; SELECT EmployeeID, FirstName, LastName FROM Employees WHERE Department = 'Sales' UNION SELECT EmployeeID, FirstName, LastName FROM Employees WHERE Department = 'Marketing';