Sql query related doubt

q- Write a query to display the name (first_name, last_name) and salary for all employees whose salary is
not in the range $10,000 through $15,000 and are in department 30 or 100.
a-SELECT
FIRST_NAME, LAST_NAME, DEPARTMENT_ID, SALARY
FROM
EMPLOYEES
WHERE
SALARY NOT BETWEEN (10000 AND 15000)
AND DEPARTMENT_ID IN (30 , 100);
what is the wrong in this query?

1 Like

Your code is correct. You just have to remove parentheses from (SALARY NOT BETWEEN (10000 AND 15000)) to SALARY NOT BETWEEN 10000 AND 15000.

1 Like

ya thanks for replying.but i want to know why i got the wrong answer when i use the bracket.so can you please help me on that?