Earlier quoted context omitted.
True story, but such questions are just senseless. 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.
Folk generally don't study relational algebra, on its own, for fun.
Our SQL interview questions
81–90 of 227 posts
Re: Our SQL interview questions
#82I 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…
Re: Our SQL interview questions
#83What is the preferred way to aggregate with nulls? SELECT Departments.name, SUM(COALESCE(salary,0)) FROM Departments LEFT JOIN employees USING departmentID GROUP BY 1 The above is how I would solve the last one, but I often feel like I abuse COALESCE.
Re: Our SQL interview questions
#84Being able to write SQL queries from memory has little correlation to a candidate's level of ability. Personally I consider myself a fairly strong developer and it hasn't been only until the last year that I can now write pretty complex joins from memory. And I've been developing for 20 years. Only because of a recent project and the volume of queries I had to write did my method change from using a graphical query writer to simply memorizing the syntax I need. Indeed, this very type of adaptation is something I look for in candidates.
Re: Our SQL interview questions
#85Earlier quoted context omitted.
> people often do an "inner join" leaving out empty departments Empty departments have less than 3 people
correct. Edited.
Besides that, I think this is a great test. Personally, I start off a bit slower so I don't embarrass people that don't know SQL.
Re: Our SQL interview questions
#86"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…
Re: Our SQL interview questions
#87What is the preferred way to aggregate with nulls? SELECT Departments.name, SUM(COALESCE(salary,0)) FROM Departments LEFT JOIN employees USING departmentID GROUP BY 1 The above is how I would solve the last one, but I often feel like I abuse COALESCE.
Aggregates generally do the right thing with null without the coalesce.
Re: Our SQL interview questions
#88Earlier quoted context omitted.
How would you solve the first one using Django ORM?
Employee.objects.filter(boss__salary__lte=F('salary')) Find me employee objects which have a boss salary less than or equal to the salary.
There's a huge performance difference involved.
Re: Our SQL interview questions
#89Earlier quoted context omitted.
Folk generally don't study relational algebra, on its own, for fun.
SQL is one of those technologies that caps how much enjoyment you can derive from understanding the related theory. Scheme, for instance, never stops giving, but you can hit a point with SQL where you start to wonder: where's my Tutorial D?
It sucks, but it's what we have for now.
Re: Our SQL interview questions
#90I 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've heard of the FizzBuzz test, right?