Resolved: Difference between IN and OR operators
Can you please explain the difference between in and or operator like why to use in operator when we are having or is it only because of the fast execution(speed) or any other reasons too?
clean code :code that is focused and understandable, which means it must be
readable, logical, and changeable
good code is not the one computers understand; it is the one
humans can understand
bref / Dont write spaghetti code ,
thanks....
Hi Sreya and Mahmoud!
Thanks for reaching out!
@ Mahmoud: Thank you for contributing to this thread with your explanation.
@ Sreya: Also, in SQL, the AND & OR operators are used for filtering the data and getting precise results based on conditions. The SQL AND & OR operators are also used to combine multiple conditions. These
two operators can be combined to test for multiple conditions in a SELECT, INSERT, UPDATE, or DELETE statement. The IN operator allows you to specify multiple values in a WHERE clause.
The IN operator is a shorthand for multiple OR conditions.
Hope this helps.
Best,
Martin