91-9990449935 0120-4256464 |
MySQL IN ConditionThe MySQL IN condition is used to reduce the use of multiple OR conditions in a SELECT, INSERT, UPDATE and DELETE statement. Syntax: Parametersexpression: It specifies a value to test. value1, value2, ... or value_n: These are the values to test against expression. If any of these values matches expression, then the IN condition will evaluate to true. This is a quick method to test if any one of the values matches expression. MySQL IN ExampleConsider a table "officers", having the following data. Execute the following query: Output: Let's see why it is preferred over OR condition: Execute the following query: Output: It also produces the same result. So IN condition is preferred over OR condition because it has minimum number of codes.
Next TopicMySQL NOT Condition
|