0

Take an example from sample HR schema. What would be query for finding employees which do not have LOCATION_ID = 1700
I have tried a query using inner join but i don't know how to go further.
The resulting query should something be like

select * from employees
inner join  departments on
    employees.DEPARTMENT_ID=departments.DEPARTMENT_ID
-->  and where departments.location_id != '1700'

Since i am taking HR schema as an example. I would like to add that in my original case location_id is a varchar2.

1 Answer 1

5

I assume you want query in Sql

select * from employees
    inner join  departments on
      employees.DEPARTMENT_ID=departments.DEPARTMENT_ID
where departments.location_id <> 1700
Sign up to request clarification or add additional context in comments.

1 Comment

Oracle supports both != and <> to indicate not equal to. The actual error, that this answer corrects, is that "and where" is not valid syntax for any database. Oh, by the way, even though this works, since department_id is varchar, it should be quoted.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.