Translation of JitBit's blog with SQL Interview Tips
My previous article unexpectedly caused a heated discussion. I decided to remember my youth (30 years ago I worked part-time as a translator of technical literature) and translate JitBit's blog with recommended SQL interview questionswith which the previous article began. The translation does not pretend to be literary, after all, I am not a writer, I am a programmer. Emoticons and word masking are preserved as in the original.
SQL Interview Questions from JitBit
Author Alex Yumashev, August 24, 2019.
Many engineers read this blog (since we have been selling help desk ticketing system, (mostly, IT people). So we decided to share our SQL questions that we ask candidates during interviews, your guys might find them useful.
Although most of our work is based on M$ SQL and our machines that we provide for test tasks are connected to M$ SQL database, test tasks are suitable for any DBMS (Oracle, PostgreSQL, MySQL, etc.) because they are very simple.
Someone will say that they are too simplebut that's a misconception. The purpose of the tests is not to identify geniuses or rock stars among the “normal” developers. Their purpose is to save you time and quickly filter out the guys who have experience with databases from those who only claim to be.
Test
![](https://habrastorage.org/getpro/habr/upload_files/d3e/810/d4c/d3e810d4c390b40e590066214f88f3ae.png)
We give our candidates this simple database diagram and ask them the following questions.
Select employees (names): who have a higher salary than their boss.
Select employees: who has the highest salary in their department.
Select departments with fewer than three employees.
Display all divisions together with the number of people in them (the catch is that people often do “inner join” and then disappear empty divisions).
Select employees whose boss is not in the same department.
Display all departments together with the total salary in them.
As I said, it's pretty simple. And there's more than one correct solution to each of these tasks.
You can use them in your interviews. And if you do, the feedback will be highly appreciated. 😉
Questions not related to SQL queries
Badly: asking candidates: “name a function that does X.” Or “how do I get the key of the last inserted record.” Or “what's the difference between varchar and nvarchar?” It's not the 90s anymore, untranslatable american swear wordsnobody needs this f*cking shit, we've had Google for that for a long time. You can find the answer in literally seconds.
Just as bad: “academic” questions like “What is DML (Data Management Language)?” or “How is First Normal Form different from Second Normal Form?” – untranslatable american swear wordswho needs this?
Fine ask broad, open-ended questions that help to establish a deep, meaningful discussion.
For example, “your database server has become slower, what should you do?” – and there is no right answer. It is just a conversation starter. Your job shut up and listen.
And you know, it's okay if a candidate answers “I'll open a browser and start googling to find a solution” – that's 100% acceptable. Or, one candidate actually said “I'll post the question on StackOverflow or its database-focused sister site” – why not!
Or “Please name your favorite difficult database problem that you've overcome” – again, a conversation starter. And if the answer is “I honestly have nothing to say about that” – that's fine. Move on to the next question.
Just make sure the question isn't meant to be answered in a straightforward way. It's meant to be used to tell a deep, meaningful story. That's the only way to identify people who can do the job, not just win Microsoft quiz shows.