简体   繁体   中英

Oracle SQL - Difference between AND & OR operators

what is the difference between AND and OR Operators?

In the online class shows that AND displays a combination of 2 different conditions whats confusing is OR does the same thing, here is an example:

select employee_id , first_name,job_id,salary

FROM employees

where department_id = 10 

OR Department_ID = 20 

AND job_id in ('FT_MGR','AC_MGR');

AND operator mean both (department_id = 10) is TRUE also (Department_ID = 20 ) is TRUE, result is TRUE

OR operator mean either (department_id = 10) is TRUE or (Department_ID = 20 ) is TRUE, result is TRUE

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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