Random Quotes for PostgreSQL Website

Over the weekend I finished off the random quotes feature for the [http://www.postgresql.org postgresql web site]. Basically what this does is allow for rotating quotes in the “featured user” box on the main site, updating every time the site get’s rebuilt by grabbing a random quote from database. One thing I thought about was that, while the random quote would help to get the page to look a little less static, there would be a downside to this for new quotes entered into the system, that might get “lost in the shuffle” so to speak. Because of that, I did a nifty little modification to the sql to favor recently made quotes, as such:
SELECT qt.quote, qt.tagline FROM quotes q, quotes_text qt WHERE q.id=qt.quoteid AND q.active AND q.approved ORDER BY modified < now() - '8 days'::interval, random() LIMIT 1
It’s simplistic, but works well enough by giving new quotes an 8 day window where they are pushed up to the top…. aren’t order by’s fun? The other part of this was to create a list of all the featured quotes, which is viewable at http://www.postgresql.org/about/quotesarchive. Hopefully with this a little more visible, we can get a few more submissions to the list from folks around the globe who are putting postgresql to good use.