Category: sql

  • NoCOUG SQL challenge

    NoCOUG (which stands for Northen California Oracle Users Group) published an SQL challenge [PDF]: using SQL determine the probability of achieving a given number by throwing a non-balanced dice N times. Being a PostgreSQL fanboy that I am, I’ve given a try with PG. Here are the results: To create the table and populate it…

  • Build a botnet – without infecting end-users

    The idea is not new: get a lot of users to view a given webpage, to DDoS the webserver / backend (depending where the bottlenecks are). If I recall correctly, some student asked the visitors of his website to continuously refresh the page of his university and got charged for it. As many have remarked…

  • Efficient SQL pagination method

    The usual technique for displaying data from an SQL query as multiple web-pages involves the LIMIT/OFFSET clause. For example for the first page the query would look like something like: SELECT foo, bar, baz FROM ozz WHERE … ORDER BY … OFFSET 0 LIMIT 10 For the second page you would do: SELECT foo, bar,…