TGTGInsighttelegram intelligenceLIVE / telegram public index
← Data Analytics
Data Analytics avatar

TGINSIGHT POST

Post #2343

@sqlspecialist

Data Analytics

Views4,780Post view count
PostedSep 2409/24/2025, 04:12 PM
Post content

Post content

πŸ“Š π—œπ—»π˜π—²π—Ώπ˜ƒπ—Άπ—²π˜„π—²π—Ώ: How do you find the Third Highest Salary in SQL? πŸ™‹β€β™‚οΈπ— π—²: Just tweak the offset: SELECT DISTINCT salary FROM employees ORDER BY salary DESC LIMIT 1 OFFSET 2; 🧠Logic Breakdown: - OFFSET 2 skips the top 2 salaries - LIMIT 1 fetches the 3rd highest - DISTINCT ensures no duplicates interfere βœ…Use Case: Top 3 performers, tiered bonus calculations πŸ’‘Pro Tip: For ties, use DENSE_RANK() or ROW_NUMBER() in a subquery. πŸ’¬Tap ❀️ for more!