What are questions to test a programmers knowledge of SQL? What is the answer to the question? And what would a lack of an correct answer mean in terms of time likely to understand the concept(s) related to the question?
GOOGLED: sql challenge
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or specific expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, see the FAQ for guidance.
It depends on how difficult you want it to be. Also, I'm a little wary of giving you the answer because most SQL problems have multiple acceptable ways to do things and there are also ways of solving SQL problems in sloppy ways that will cause other issues. The person "grading" the answer definitely needs to be able to solve it on their own.
That said, here are a few I came up with off the top of my head.
Extremely Easy Level:
Medium Level Given the employee table above, write a query to calculate the difference (in days) between the most and least tenured employee still working for the company?
|show 1 more comment|
I would ask "Why and how should you sanitize input values given from the user which will be used in an SQL query?"
This is needed to prevent SQL injections, and being able to answer this requires good knowledge about SQL syntax and commands (such as
I only generally sit on interviews for data specialists, so my questions tend to be hard. But one thing I would require of anyone who will be writing SQL is knowledge of joins and when to use a left join vice an inner join. Anyone who doesn't understand that has no business querying a database in any way shape or form.
Another thing I would do is make sure they understand how to do a GROUP BY and use Aggregate functions.
And the differnce between UNION and UNION ALL has eliminated a lot of poor candidates at my job.
I had a hand in developing a technical test for database programmers. The questions were what I consider quite basic: write the CREATE TABLE statements for a given table structure; do some simple queries; etc.
Most job applicants who called themselves experts at SQL flunked the test. One said that although he had been an SQL developer for many years, he had never written a CREATE TABLE statement because the GUI did it for him.
We've had similar experiences with other technical tests. For Windows support staff, the tasks are similar to "create a domain user," "add a printer," "change permissions on a file." Most people can't do those tasks, especially under pressure. We figure that if you can do even the simple stuff, you're probably pretty competent.
If you prefer to ask more open questions: Ask general questions about the DATE, DATETIME... data types. Ask about differences between different vendor implementations / products. Talk about command line tools, bulk loaders, pretty printers... maybe you can learn a new trick during the interview.