How to Write Efficient TOP N Queries in SQL

A very common type of SQL query is the TOP-N query, where we need the "TOP N" records ordered by some value, possibly per category. In this blog post, we're going to look into a variety of different aspects to this problem, as well as how to solve them with standard and non-standard SQL. These … Continue reading How to Write Efficient TOP N Queries in SQL

Stop Trying to Emulate SQL OFFSET Pagination with Your In-House DB Framework!

I'm pretty sure you've gotten it wrong in numerous ways, so far. And you probably won't get it right any time soon. So why waste your precious time on SQL tweaking, when you could be implementing business logic? Let me explain... It hasn't been until the recent SQL:2008 standard that what MySQL users know as … Continue reading Stop Trying to Emulate SQL OFFSET Pagination with Your In-House DB Framework!

SAP’s Hilarious SQL Whitepaper(s)

While looking for some authoritative information about Sybase SQL Anywhere 12's TOP .. START AT clause, I stumbled upon this hilarious white paper here, which I do not want to keep from you: http://www.sybase.com/files/White_Papers/Sybase_Top_10_Features_In_SQL_Anywhere_12.pdf I will take advantage of "fair use policy" and cite parts from section 7: Feature number 7: improved support for DaffySQL … Continue reading SAP’s Hilarious SQL Whitepaper(s)