Hi Experts, I need some clarifications on “WHERE” clause extended conditions. Let’s say I have a where clause with couple of scenarios like below
1.Where customer Id=’pk’ and store_number =’001’ And Oder_Id=’ 221’ and Product_ID=’333’ Company_name =X OR Company_name=Y
2. where (customer Id=’pk’ and store_number =’001’ And Oder_Id=’ 221’ and Product_ID=’333’ Company_name =X OR Company_name=Y)
3. where (customer Id=’pk’ and store_number =’001’ And Oder_Id=’ 221’ and Product_ID=’333’ ( Company_name =X OR Company_name=Y))
4. where(customer Id=’pk’ and store_number =’001’ And (Oder_Id=’ 221’ and Product_ID=’333’) ( Company_name =X OR Company_name=Y))
I understand in 1 st scenario 'And' condition will execute first as it has high priority than OR , would it be the same case in 2nd scenario which just has parenthesis. My understanding is 3rd scenario OR will be executed first as I have prioritized it.In 4rth scenario And will be executed first then OR and lastly the and. Please correct me if I am wrong. Thanks.