SQL style guide by Simon Holywell(sqlstyle.guide) You can use this set of guidelines, fork them or make your own - the key here is that you pick a style and stick to it. To suggest changes or fix bugs please open an issue or pull request on GitHub.
10 points by KolmogorovComp 45 days ago | 1 comments
Null Is Not the Billion Dollar Mistake. A Counter-Rant (2015)(jooq.org) A short while ago, I gave this answer on Quora. The question was “What is the significance of NULL in SQL?” and most of the existing answers went on about citing C.J. Date or Tony Hoare and unanimously declared NULL as “evil”.
332 points by regexman1 57 days ago | 162 comments
Google Zanzibar: Implementing the Check API and Expand API Using .NET (2023)(bytefish.de) In the previous articles we have seen how to implement a very simplified Relationship-based Access Control using a Google Zanzibar-like data model and some SQL queries. It worked good, and I quite like what we ended up with. But it doesn't let us define an effictive ACL, because at the moment we need to materialize all relations in the database.
Why avoid where id in with variable number of bind parameters on Postgres(kaveland.no) In my post about batch operations, I used the where id = any(:ids) pattern, with ids bound to a JDBC array. I’ve gotten questions about that afterwards, asking why I do it like that, instead of using in (:id1, :id2, ...). Many libraries can take care of the dynamic SQL generation for you, so often you can just write in (:ids), just like the array example.
Window Functions for Data Analysis with Postgres(crunchydata.com) SQL makes sense when it's working on a single row, or even when it's aggregating across multiple rows. But what happens when you want to compare between rows of something you've already calculated? Or make groups of data and query those? Enter window functions.