Home » Other » Training & Certification » Oracle SQL 1Z0-071
Oracle SQL 1Z0-071 [message #665015] Thu, 17 August 2017 13:44 Go to next message
galileo213
Messages: 3
Registered: August 2017
Junior Member
Hello Morris,

I just bought your eBook regarding Oracle sql 1z0-071 prep on Amazon. I have some concerns concerning logical operators precedence.
In *Limit the rows that are retrieved by a query* topic, you state OR operator has equal precedence with AND operator. But later inside the same topic you state according to the Oracle SQL Reference manual : AND condition has precedence over OR condition.

Could you please clarify for a better understanding ?


Thx
Re: Oracle SQL 1Z0-071 [message #665016 is a reply to message #665015] Thu, 17 August 2017 13:50 Go to previous messageGo to next message
BlackSwan
Messages: 25745
Registered: January 2009
Location: SoCal
Senior Member
Who is Morris?
Why do you think he hangs out here to answer your questions

Welcome to this forum

Please read and follow the forum guidelines, to enable us to help you:

OraFAQ Forum Guide
How to use {code} tags and make your code easier to read

Re: Oracle SQL 1Z0-071 [message #665017 is a reply to message #665016] Thu, 17 August 2017 14:27 Go to previous messageGo to next message
galileo213
Messages: 3
Registered: August 2017
Junior Member
Thanks for sharing forum's guideline

> Who is Morris?
Sorry, I mean Matthew Morris (matthewmorris68) Author of eBook entitled "Study Guide for 1Z0-071 : Oracle Database 12c SQL : Oracle Certification Prep".

Could you please help me about my question ? Smile


Thanks
Re: Oracle SQL 1Z0-071 [message #665019 is a reply to message #665017] Thu, 17 August 2017 14:45 Go to previous messageGo to next message
BlackSwan
Messages: 25745
Registered: January 2009
Location: SoCal
Senior Member
 matthewmorris68's Profile
Date Registered:	Thu, May 24, 2012
Message Count:	258 Messages (0.13 average messages per day)
Show all messages by matthewmorris68
Status:	Senior Member
Avatar:	
Last Message:	Mon, 24 October 2016 11:15
Re: Test Strategy Still Valid? -- Matt Morris Article
Last Visited:	Mon, 31 October 2016 06:12
NOTE last line above.

>Could you please clarify for a better understanding ?

What prevent YOU from doing some actual SQL testing to observe for yourself how Oracle behaves?

http://lmgtfy.com/?q=oracle+precedence+of+and+%26+or
Re: Oracle SQL 1Z0-071 [message #665020 is a reply to message #665015] Thu, 17 August 2017 15:09 Go to previous messageGo to next message
Michel Cadot
Messages: 65252
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

SQL> select * from emp
  2  where deptno = 10 and empno = 7782 or empno = 7902
  3  /
     EMPNO ENAME      JOB              MGR HIREDATE                   SAL       COMM     DEPTNO
---------- ---------- --------- ---------- ------------------- ---------- ---------- ----------
      7782 CLARK      MANAGER         7839 09/06/1981 00:00:00       2450                    10
      7902 FORD       ANALYST         7566 03/12/1981 00:00:00       3000                    20

2 rows selected.
Is this
SQL> select * from emp
  2  where deptno = 10 and (empno = 7782 or empno = 7902)
  3  /
     EMPNO ENAME      JOB              MGR HIREDATE                   SAL       COMM     DEPTNO
---------- ---------- --------- ---------- ------------------- ---------- ---------- ----------
      7782 CLARK      MANAGER         7839 09/06/1981 00:00:00       2450                    10

1 row selected.
or
SQL> select * from emp
  2  where (deptno = 10 and empno = 7782) or empno = 7902
  3  /
     EMPNO ENAME      JOB              MGR HIREDATE                   SAL       COMM     DEPTNO
---------- ---------- --------- ---------- ------------------- ---------- ---------- ----------
      7782 CLARK      MANAGER         7839 09/06/1981 00:00:00       2450                    10
      7902 FORD       ANALYST         7566 03/12/1981 00:00:00       3000                    20

2 rows selected.
But of course the correct answer is:

NEVER rely on any precedence, ALWAYS use parentheses to show what you want to do and be sure this is what you do.

[Updated on: Thu, 17 August 2017 15:11]

Report message to a moderator

Re: Oracle SQL 1Z0-071 [message #665025 is a reply to message #665020] Fri, 18 August 2017 02:29 Go to previous message
galileo213
Messages: 3
Registered: August 2017
Junior Member

I shall consider your answer as an advice.
Thanks a lot.
Previous Topic: SQL Tuning course - free!
Next Topic: Database Design Project
Goto Forum:
  


Current Time: Wed Dec 13 23:06:09 CST 2017

Total time taken to generate the page: 0.01353 seconds