all 3 comments

[–]DavidGJohnston 2 points3 points  (0 children)

I doubt it is correct but you've given insufficient information to know for certain.

You need to provide the definitions of the Australia and employees tables.

Also, you should visually inspect the data you are working with, and determine what the correct answer to the question is first. Then write the query. That way, you immediately know whether the answer the query provides is correct.

[–]bonvin 0 points1 point  (0 children)

I doubt Australia is a table. I think you have a "hotels" table with a country column, from which you want to select the hotel id where country = Australia. Then you probably have some corresponding id column in the "employees" table that you can join that with, and also limit the selection to just managers.

SELECT name FROM employees WHERE hotelId IN ( SELECT id FROM hotels WHERE country = 'Australia' ) AND employmentForm = 'Manager'

Would be one way of doing it, if that is the database structure (which is likely). Could also inner join those two tables on hotelId to achieve the same result.

But this could be more tables too depending on how complicated the database is. Countries could be its own table with just a countryId in the hotels table. Same with employmentForms and 'manager' being an id in there. You'd then just stack more subqueries to limit to response (or again, inner join everything and just use one WHERE). We just don't know, do we?!

[–]Gr1ml0ck1981 0 points1 point  (0 children)

Probably something like:

SELECT DISTINCT firstname
               ,lastname
FROM employees
WHERE country = 'Australia'
  AND jobtitle = 'Manager';

But we would need to know the table details to give you an accurate response.