Wulf's Webden

The Webden on WordPress

With

| 0 comments

I’ve been doing a lot of SQL in recent weeks drawing on the knowledge I’ve built up over years. However, I’ve still managed to pick up one or two approaches that were new to me.

One of those is the WITH keyword. You can declare a series of temporary tables (WITH mynewtable AS (SELECT statement…)) and then use in the query that follows. In the past I would have solved that with gnarly joins or dropping subqueries further down but there is something rather elegant about creating some temporary tables first. It keeps things neat and avoids some of the deep folds in which bugs like to hide!

Anyway, WITH is a strong contender in the unlikely event that someone asks me for my current favourite SQL keyword!

Leave a Reply

Required fields are marked *.


This site uses Akismet to reduce spam. Learn how your comment data is processed.