Post by Prateek Jalgaonkar

Lead Analytics Engineer @ Cigna Evernorth | Building Scalable Healthcare Analytics Systems

I can’t believe I used to write 20 UNIONs in one SQL query 😅 When I was learning SQL, I needed to generate a list of rows. So what did I do? Yup… SELECT REPEAT('*',1) UNION ALL SELECT REPEAT('*',2) UNION ALL ....… all the way to 20 🥴 It worked — but it was ugly. Now here’s the cleaner version 👇 WITH RECURSIVE nums AS (  SELECT 1 AS n  UNION ALL  SELECT n + 1 FROM nums WHERE n < 20 ) SELECT REPEAT('*', n) AS stars FROM nums; No copy-paste, no clutter — just one elegant loop inside SQL. That's Recursive CTEs for you! It’s one of those SQL moments that makes you feel like you leveled up. Who else has had this kind of SQL realization lately? 👇 #SQL #DataAnalytics #DataCommunity #LearningSQL #DataEngineering #PostgreSQL #MySQL #SQLServer