简体   繁体   English

SQL查询联接表-Oracle

[英]SQL query joining tables - Oracle

Take an example from sample HR schema. 以示例HR模式为例。 What would be query for finding employees which do not have LOCATION_ID = 1700 查找没有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. 由于我以HR模式为例。 I would like to add that in my original case location_id is a varchar2. 我想补充一点,在我的原始情况下,location_id是varchar2。

I assume you want query in Sql 我假设您要在Sql中查询

select * from employees
    inner join  departments on
      employees.DEPARTMENT_ID=departments.DEPARTMENT_ID
where departments.location_id <> 1700

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM