DBA Interview Question
- Posted by Sqltimes
- On September 4, 2011
- 0 Comments
A few days ago, I saw a set of good interview questions to ask a DBA. I want to post answer to “10. Solve the FizzBuzz problem with SQL code“
DECLARE @n INT = 25
;WITH MyCTE (Num)
AS
(
SELECT 1 AS [Num]
UNION ALL
SELECT Num + 1 AS [Num]
FROM MyCTE
WHERE Num < @n
)
--SELECT * FROM MyCTE
SELECT Num
, CASE
WHEN (Num % 3 = 0) AND (Num % 5 = 0) THEN 'FizzBuzz'
WHEN Num % 3 = 0 THEN 'Fizz'
WHEN Num % 5 = 0 THEN 'Buzz'
ELSE CONVERT(VARCHAR, Num)
END AS [Mod3And5]
FROM MyCTE
GO
Comment on the rest of the question: Though the questions, at first, seem not technical, I feel that the idea behind these questions is important. You can know a lot about a Senior DBA through these questions than just asking them the regular technical questions. If I am interviewing a Senior DBA, I want to know their thinking style, their approach to problems more importantly than knowing answer to something like “What RECOVERY model is required to set up database mirroring on a database?”. You can always look up BoL for these when you are actually setting up DB Mirroring, but you cannot look up ‘thinking’‘.
Hope this helps,
0 Comments