Caveat: Dreaming in SQL


-- I awoke from a dream this morning muttering,
-- "Well, I better to get to work
-- on that data warehouse."
--
-- The dream was one of those SQL coding dreams I used
-- to have a lot, when I was working as an SQL coder.
-- Screens filled with half-written SQL queries written
-- against the infamous ARAMARK datawarehouse (or my
-- surreptitious 2 terabyte copy of it that was running
-- on the "National Accounts Stealth Server" that I'd
-- constructed under my desk), in which I'd denormalized
-- the database to speed up pivot table queries of
-- various kinds. Dreams filled with feelings of anxiety
-- and urgency and frustration. I almost never have
-- those dreams, anymore - I haven't done a single
-- line of programming in almost 5 years, now. I'm a
-- happier and more balanced person, because of
-- it (though not perfect, oh no, I know).
--
-- But sometimes dreams do weird things, and this
-- early dawn, as my cold medicine wore off (I'm combatting
-- an unpleasant flu currently), I was plunged
-- into a vivid relapse of my database-hacking days. And I
-- awoke with a sense that I was behind on some ill-defined
-- but very important project, some report due
-- that day and the queries were running too slow, some
-- effort to find some ineluctable fragment of
-- information or some anomalous, dangerous data point
-- that the sales people insisted shouldn't exist and
-- would embarrass us in front of the customer, but
-- lo and behold, there it was glaring up from the
-- spreadsheet.
--
-- I made some of my Brazilian instant coffee, and
-- ate toast and an apple for breakfast.
--
-- Below is a dummy query from a SQL educational
-- website. Just to give a flavor or my dreaming.
DECLARE @PivotColumnHeaders VARCHAR(MAX)
SELECT @PivotColumnHeaders =
COALESCE(
@PivotColumnHeaders + ',[' + [MonthName] + ']',
'[' + [MonthName] + ']'
)
FROM dummy.dbo.ListMonthNames()
ORDER BY monthid
--
DECLARE @PivotTableSQL NVARCHAR(MAX)
SET @PivotTableSQL = N'
SELECT *
FROM (
SELECT
YEAR(OrderDate) [Year],
DATENAME(MONTH, OrderDate) as [Month],
SubTotal
FROM Sales.SalesOrderHeader
) TableDate
PIVOT (
SUM(SubTotal)
FOR [Month] IN (
' + @PivotColumnHeaders + '
)
) PivotTable
'
EXECUTE(@PivotTableSQL)
-- What I'm listening to, right now.
-- Kray Van Kirk, "You to me." There's no youtube or other
-- online video for this song. So... find your own copy - his
-- music is free from his website (I wonder... I should make my
-- own youtube. I wonder if he would object?

CaveatDumpTruck Logo

Caveat: Free-Will Inspection

Koreans (like most Asians) often wear T-shirts with incomprehensible English on them. It’s like the clothing companies have hired unemployed Nigerian spamists to write their T-shirt slogans. I wish I took a picture of the phrase I saw today. I was walking to work earlier and saw one of those modern Korean dads – pushing the baby stroller, talking on his cell phone, dressed super-casually in jeans and T-shirt.

But then, in large maroon letters on the back of his shirt, it said, “Free-Will Inspection.” I didn’t get to see the front.

But I wonder what “Free-Will Inspection” is supposed to be. How does it work? If I decided to undergo Free-Will Inspection, would I get a positive result? If I flunk my Free-Will Inspection, does that mean I have a free will or don’t have a free will? Which is the preferable outcome?

CaveatDumpTruck Logo

Back to Top