Hacker News new | past | comments | ask | show | jobs | submit login

Not in my experience. Please show me actual examples of "well-written modular SQL" in a real application.



I'm taking a bit of creative license with the term "modular". CTEs and views can help with this, and are closer to true modules.

I like to encapsulate inside of stored procedures, and write my code in such a way that it reads almost like a a procedural language. Heavy use of indentation, subqueries, and temp tables lets you carry results through the proc. I like to hang conditions off of joins, so related logic is in the same place.


Would modular sql be wrapping up subqueries inside of views, and then selecting from those views?


Common Table Expressions (CTEs) help with modular SQL.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: