Right... Good call. In that case, the sales table should have a default for the department id field set to 0, and then the unknown row would have an ID of 0
Because id cannot be null in table departments (cause PK), then no values will be provided for result.
If the db is built properly, the departments table would have a null row that would have the name "Unknown"
And what happens if the department_id field of the sales table is null your solution falls.
eval() is now disabled
Note: python 2 & 3 compatible solution
It probably means that your solution doesn't work with integer string values as described in the problem description. Your solution returns [1.0, 2.0, 3.0] for parameter array ["1", "2", "3"] whereas it should return [1, 2, 3]. The test set seems to be a bit lacking as they are not testing this case.
Don't understand question :(
What about integers?
Yeap, you can join same table multiply times if it's needed
You need to check, that there is not eval func in solution.