3 ms·
SQL is a write-only language. You better hope you don't have to rewrite your complicated raw SQL queries in the future.
by Grue3 10y ago
SQL is a write-only language. You better hope you don't have to rewrite your complicated raw SQL queries in the future.
- bdcravens 10y agoYou can write well written modular SQL that supports changes and can be read by a competent developer.
- Grue3 10y agoNot in my experience. Please show me actual examples of "well-written modular SQL" in a real application.
- Something1234 10y agoWould modular sql be wrapping up subqueries inside of views, and then selecting from those views?
- jsmeaton 10y agoCommon Table Expressions (CTEs) help with modular SQL.
- bdcravens 10y agoI'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.
- maxxxxx 10y agoIf you do SQL full-time probably yes. The problem is that most developers don't work enough with it so their skills are lacking.