TGViewer
SQL Programming Resources SQL Programming Resources @sqlanalyst · 76.7K subscribers
Post #2408 3.73K
16. What is the difference between INNER JOIN and EXISTS?
- INNER JOIN: returns combined columns from both tables where keys match.
- EXISTS: checks if a subquery returns any rows; usually faster when you only care about existence (e.g., filtering with WHERE EXISTS).


17. What is a FULL OUTER JOIN?
Returns all rows from both tables. If there's no match, unmatched sides are filled with NULL. Useful to see data that exists in either table but not in both.


18. How do you find duplicates across tables?
Use INTERSECT or:
SELECT t1.
FROM table1 t1
WHERE EXISTS (
SELECT 1 FROM table2 t2
WHERE t1.key = t2.key
);
Or use UNION ALL + GROUP BY to count occurrences.


19. What are SQL constraints?
Rules that enforce data integrity:
- PRIMARY KEY, FOREIGN KEY, UNIQUE, NOT NULL, CHECK, DEFAULT.
They keep data consistent and help the query optimizer.


20. Explain GROUPING SETS.

GROUPING SETS lets you define multiple grouping levels in one GROUP BY:

GROUP BY GROUPING SETS (
(), -- grand total
(a), -- by a
(b), -- by b
(a, b) -- by a and b
);
Useful for multi‑level summaries (like OLAP reports).

SQL Programming: https://whatsapp.com/channel/0029VanC5rODzgT6TiTGoa1v

Double Tap ❤️ For More
  • ❤ 5
More from @sqlanalyst
  1. Oct 9, 2026SQL Interview Series — Part 5 📌 Question 5: Find Employees Who Earn More Than Their Manag…
  2. Oct 9, 2026🇮🇳 𝗚𝗢𝗩𝗘𝗥𝗡𝗠𝗘𝗡𝗧 𝗢𝗙 𝗜𝗡𝗗𝗜𝗔 — 𝗔𝗜𝗖𝗧𝗘 𝗜𝗡𝗧𝗘𝗥𝗡𝗦𝗛𝗜𝗣𝗦 𝟮𝟬𝟮𝟲 🚀…
  3. Oct 8, 2026🎓 𝗠𝗶𝗰𝗿𝗼𝘀𝗼𝗳𝘁 𝗙𝗥𝗘𝗘 𝗖𝗼𝘂𝗿𝘀𝗲𝘀 𝘄𝗶𝘁𝗵 𝗖𝗲𝗿𝘁𝗶𝗳𝗶𝗰𝗮𝘁𝗲𝘀! 🚀🔥 Upgr…
  4. Oct 7, 2026🚀𝗣𝗮𝘆 𝗔𝗳𝘁𝗲𝗿 𝗣𝗹𝗮𝗰𝗲𝗺𝗲𝗻𝘁 𝗧𝗿𝗮𝗶𝗻𝗶𝗻𝗴 | 𝗕𝗲𝗰𝗼𝗺𝗲 𝗮 𝗙𝘂𝗹𝗹𝘀𝘁𝗮𝗰…
  5. Oct 7, 2026SQL Interview Series — Part 4 📌 Question 4: Find the Highest Salary in Each Department Su…
  6. Oct 7, 2026𝗠𝗮𝘀𝘁𝗲𝗿 𝗣𝗼𝘄𝗲𝗿 𝗕𝗜 𝗳𝗼𝗿 𝗙𝗥𝗘𝗘! 🔥 Learn Power BI through these FREE learnin…
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →