Nullability is a concept that occasionally causes consternation among SQL developers, especially new ones. It is a somewhat controversial construct and some believe relational databases should not allow NULLs at all. (See C.J. Date) Like it or not, the concept made it into the relational model and we might as well take advantage of it where possible. Imagine a table that contains parts of a...
Pithy SQL is a blog devoted to writing simple, clear, expressive SQL WITHOUT…
Without loops – while loops and cursors
Without variables – both scalar-valued and table-valued
Without intermediate tables – temporary or permanent
Without dynamic SQL
These constructs are not evil, and they’re the best solution to many problems, but they’re not pithy.
Pithy defined: precisely meaningful; forceful and brief. Simple solutions that accomplish a task in one statement are usually more readable, maintainable, reusable and performant than more complicated solutions.
SQL should have style, not in the generic sense like coding style, but in the exciting sense of “you have STYLE!”.
Pithy SQL is all about maximizing the declarative beauty of the SQL language. Why be imperative when you can be declarative?
Jerry Seinfeld said “I will spend an hour taking an eight word sentence and editing it down to five.” In that vein, Pithy SQL strives to eliminate the superfluous to produce concise, effective SQL that looks great in the editor and performs great in the query processor.
Recent Comments