Last month’s post “For Technical Interviews, Don’t Ask Questions, Show Screenshots” was a surprise hit, and lots of folks asked for more details about the types of screenshots I’d show. Over the next few weeks, I’ll share a few more.
Normally I’d show this query as a screenshot, but for easier copy/pasting into comments, I’m showing it as code here.
CREATE PROC dbo.usp_ByCategory @Category NVARCHAR(20) AS
IF @Category = NULL SET @Category = 'Default'
SELECT i.itemID, i.itemName,
COALESCE(po.Price, i.Price, 0) AS Price
FROM Items I
LEFT OUTER JOIN PriceOverrides po
ON i.itemID = po.itemID
AND po.SaleStartDate >= GETDATE()
AND po.SaleEndDate <= GETDATE()
WHERE i.Category = @Category
I’d say to the job candidate, “You’ve been asked to take a quick look at this code as part of a deployment. Explain what the business purpose of the code is, and tell me if there’s anything that concerns you.”
After a few days, I’ll follow up with my own thoughts in the comments.