Show the name, email and city of the users, which surename is Austin or name "Lara" and "Daniel", whereby they have a salary between 100000 and 300000 and they are not from "Liverpool".
By the way, don't you think teacher made a mistake her condition, where she say: "or name Name Lara and Daniel".
Logically user can't have two names (and there is no a column with additional name or father name), so I put instead OR operator...Am I correct ?
SELECT NAME, EMAIL, CITY FROM `contacts` WHERE (SURENAME = 'Austin' OR (NAME = 'Lara' OR NAME = 'Daniel')) AND SALARY BETWEEN 100000 AND 300000 AND CITY NOT IN ('Liverpool')
However, I look at the table and none of this rows from a table has this condition, so as a result I got:
NAME | EMAIL | CITY
NULL NULL NULL
Is this ok, if for result I get NULL ?
This post has been edited by nellykvist: 10 November 2013 - 09:24 AM