Skip to content
Advertisement

Tag: limit

PostgreSQL – repeating rows from LIMIT OFFSET

I noticed some repeating rows in a paginated recordset. When I run this query: I get: Next query: I get: Why does “foo” appear in both queries? Answer Why does “foo” appear in both queries? Because all rows that are returned have the same value for the status column. In that case the database is free to return the rows

Combining UNION and LIMIT operations in MySQL query

I have a Jobs and a Companies table, and I want to extract 20 jobs that meet the following criteria: Jobs only from two (2) named companies There can at most be 10 jobs per company I have tried the following SELECT with UNION DISTINCT, but the problem is that the LIMIT 0,10 applies to the whole result set. I

Should SQL ranking functionality be considered as “use with caution”

This question originates from a discussion on whether to use SQL ranking functionality or not in a particular case. Any common RDBMS includes some ranking functionality, i.e. its query language has elements like TOP n … ORDER BY key, ROW_NUMBER() OVER (ORDER BY key), or ORDER BY key LIMIT n (overview). They do a great job in increasing performance if

Advertisement