We are hiring a DBA at my company Corzen and instead of looking at resumes/cvs we are looking at how people solve particular SQL problems-not just the solution but the approach they take. (Do you use temp tables, (nolock), CTEs, table alias, etc.)
Here are the five test questions we ask. (If you want to come work here, just email me the answers.)
Here are three TSQL problems that can judge how you approach a SQL problem. There are no real wrong answers, but the more efficient and bulletproof the query is the better. No cheating and no cursors! Don't cheat and don't google the answers (we'll know.)
Step 1: run SetupTSQLProblems.sql in any database.
Finding Duplicate Products in the Product table. Write a query to list only the duplicated products in the Products table. Assume that the dupe is the product with the highest Product_ID. The results of your SQL statement should be:
Assign rooms to classes based on capacity using the Classes and Rooms tables. Rules: each class should have a room (and NULL if a room is not available). No class can be in a room where there are more students than capacity. No room can be used twice.
The results of your SQL statement should be:
Advanced SQL Queries
Introduction to C#
XQuery Deep Dive
Make the following static pivot dynamic in AdventureWorks, assume that the orderyear can increment to 2005 and 2006. Assume that order years can skip.
FROM (SELECT CustomerID, YEAR(OrderDate) AS orderyear, TotalDue
FROM Sales.SalesOrderHeader) as Header
PIVOT(SUM(TotalDue) FOR orderyear IN(,,)) as Piv
You have a piece of XML:
<employee num="1">Steve< SPAN>employee>
<employee num="2">Al< SPAN>employee>
<employee num="3">Mike< SPAN>employee>
<employee num="4">Malisha< SPAN>employee>
<employee num="1">Remon< SPAN>employee>
<employee num="2">Lamees< SPAN>employee>
<employee num="3">Bassma< SPAN>employee>
<employee num="1">Vinay< SPAN>employee>
<employee num="2">Pradeep< SPAN>employee>
<employee num="3">Rashmi< SPAN>employee>
<employee num="4">Sujata< SPAN>employee>
<employee num="5">Ajit< SPAN>employee>
<employee num="1">Amrat< SPAN>employee>
A. Using the XML datatype, write an XQuery to return the 3rd employee in the NYC office. Your results should look like:
B. Using the XML datatype, write an XQuery to return the 3rd employee in each office. Your results should look like:
Using adventureworks, rank each salesperson by total sales in 2004 with the rank starting over for each country. Do not use temp tables, self joins, or cursors.
Page rendered at Monday, April 19, 2021 2:17:33 AM (Eastern Daylight Time, UTC-04:00)
The opinions expressed herein are my own personal opinions and do not represent
my employer's view in anyway.