TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Correlated Subqueries in SQL

5 pointsby polyrandalmost 2 years ago

1 comment

mikecealmost 2 years ago
One of the things I kinda miss from when I was a mid-level developer was writing advanced SQL stored procedures. The peak of my stored proc skills was rewriting a stored proc that took in about 16 parameters which were optional filters on a query... the original query was about 4000 lines of code that was effectively the query with all of the possible branches of the logic. The rewrite was maybe 25 lines with subqueries that had no filtering effect if a null or non-value was passed in. Not only was the result orders of magnitude more elegant and easier to grok but it was significantly faster as well. I really wish I had printed and framed that one because now I would have a hard time remembering (or even Googling) how to replicate the logic (that's what my mid-range developers and database devs are for these days).