Set operations = multiple SELECT results ko “vertically” combine karna.
Matlab rows ko upar-neeche stack karna.
Socho:
Table1 ka result + Table2 ka result → ek final result set.
✅ Set ops = row-wise combination
✅ Joins = column-wise combination
Notes me likha hai “Always distinct.”
✅ Ye UNION ke liye true hai, but set ops me 2 versions hoti hain:
UNION → duplicates remove (distinct)UNION ALL → duplicates keep (faster)INTERSECT / EXCEPT typically distinct behavior rakhte, but DBs me ALL variants bhi kabhi-kabhi milte hain.
Do ya zyada SELECT results ko merge (stack) karna, duplicates hata ke.
SELECT*FROM table1
UNION
SELECT*FROM table2;