I could nail those with the Django ORM, but I'd struggle to write syntactically correct SQL, not having done it in a while. But it says that your test machine has MS-SQL; with the machine in front of me, I could probably puzzle it out the join quirks with a couple minutes of trial and error.
How would you solve the first one using Django ORM?
Our SQL interview questions
41–50 of 227 posts
Re: Our SQL interview questions
#42I'm not a SQL Developer, but anytime I get questions for which Google has answers to be found in 5 minutes or less, I'm quite hesitant to work there. I respect interviews that go along the lines of: "What would you do if..." after giving a detailed description of their environment. But then again I'm a tools/OSes admin, so maybe it makes more sense for my job description. But anytime guys are too focused on third opt…
"Some people might say it is too basic, but that's not the point. The test's job is not to tell genius and rockstars from "normal" devs. The purpose is to save you time and quickly filter out DB-experienced guys from the ones that just claim to be."
Re: Our SQL interview questions
#43I'm not a SQL Developer, but anytime I get questions for which Google has answers to be found in 5 minutes or less, I'm quite hesitant to work there. I respect interviews that go along the lines of: "What would you do if..." after giving a detailed description of their environment. But then again I'm a tools/OSes admin, so maybe it makes more sense for my job description. But anytime guys are too focused on third opt…
I don't run a school. Anytime a web-developer does not know basic sql or other basic knowledge, I refuse to pay salary, and even deduct the 1$ per minute. That five minutes just cost you $10
Instead of paying a nominal price for people relearning some primitives for a specialized area of IT/software dev, nowadays most companies want the new kids to go to $80,000 worth of college for the same. That way, the employer gets to skip training, and the student is less likely to leave because he or she has too much damned debt to be mobile.
Maybe I'm projecting.
Re: Our SQL interview questions
#44 SELECT e1.Name FROM Employees e1 LEFT OUTER JOIN Employees e2
ON (e1.BossID = e2.EmployeeID)
WHERE e1.Salary > e2.Salary
"List departments that have less than 3 people in it" SELECT d.Name, COUNT(e.EmployeeID) FROM Department d LEFT OUTER JOIN Employees e
ON (d.DepartmentID = e.DepartmentID)
GROUP BY d.Name HAVING COUNT(e.EmployeeID)
"List all departments along with the total salary there" SELECT d.Name, SUM(e.Salary) FROM Department d INNER JOIN Employees e
ON (d.DepartmentID = e.DepartmentID)
GROUP BY d.Name
"List employees that don't have a boss in the same department" SELECT e1.Name FROM Employees e1 LEFT OUTER JOIN Employees e2
ON (e1.BossID = e2.EmployeeID)
WHERE e1.DepartmentID e2.DepartmentID
"List all departments along with the number of people there" SELECT d.Name, COUNT(e.EmployeeID) FROM Department d
LEFT OUTER JOIN Employees e
ON (d.DepartmentID = e.DepartmentID)
GROUP BY d.NameRe: Our SQL interview questions
#45Which book would you recommend for learning this stuff? I'm not very interested in 800-p. gorillas; there surely must be something short, not too theoretical, and to the point.
Pick books focusing to SQL, not on databases overall.
Most database textbooks (Date, Ramakrishnan & Gehrke) cover a lot of ground, rather than just the language.
Re: Our SQL interview questions
#46I could nail those with the Django ORM, but I'd struggle to write syntactically correct SQL, not having done it in a while. But it says that your test machine has MS-SQL; with the machine in front of me, I could probably puzzle it out the join quirks with a couple minutes of trial and error.
How would you solve the first one using Django ORM?
Re: Our SQL interview questions
#47I took a similar test, on-line while being watched. 4 sets of 10 multiple choice questions: SQL, unix commands, vi, & HTML. Make your 10 choices, click submit, get your score. It was kinda silly, but what the heck... It was ridiculously easy and I got all 40 right without much thinking, as many people here would also, I imagine. Then I asked, "Why bother with this after reading my resume?" They answered, "We have to…
You're aware that not everyone tells the truth on their resume right?
> Is this the state of our industry now?
Now? It's always been this bad... Happens when demand for talent out strips supply - the bar keeps falling.
Re: Our SQL interview questions
#48Earlier quoted context omitted.
I would imagine questions that are good to start with: how you as a developer usually start a design of a database? How do you plan it? I got this question once, I thought it was really good. On the spot I could tell the engineer who asked me that is experienced. Can't answer that after reading sql book two days earlier. In contrast to the questions from the post.
In a business setting, the conceptual/relational, logical and physical design of a database happens far less often than querying such databases. Indeed, one of the reasons normalisation is such a Big Deal to relational bigots like me is that it makes SQL's querying tools much more useful and versatile.
If someone knows about set-theory and the ideas behind query-languages, knowing SQL isn't a deal breaker, it's just a nice to have.
Re: Our SQL interview questions
#49A sample SQL file with dummy data would be much appreciated, I think. I guess some of us would like to try their luck. At least this should be quicker in an interview situation than the usual "normalize this database" or "given this situation, define a database schema".
I made the tables quick to go through them. It could do with more data really but its got a few rows. https://gist.github.com/abkr/5662615
Re: Our SQL interview questions
#50"List employees (names) who have a bigger salary than their boss" SELECT e1.Name FROM Employees e1 LEFT OUTER JOIN Employees e2 ON (e1.BossID = e2.EmployeeID) WHERE e1.Salary > e2.Salary "List departments that have less than 3 people in it" SELECT d.Name, COUNT(e.EmployeeID) FROM Department d LEFT OUTER JOIN Employees e ON (d.DepartmentID = e.DepartmentID) GROUP BY d.Name HAVING COUNT(e.EmployeeID) "List all departme…
Empty departments have less than 3 people