SQL IN is an operator used in a SQL query to help reduce the need to use multiple SQL “OR” conditions.

It is used in SELECT, INSERT, UPDATE or DELETE statement.

Advantage of SQL SELECT IN

It minimizes the use of SQL OR operator.

Let’s see the syntax for SQL IN:

Expression IN (value 1, value 2 ... value n);  

Take an example with character values.

 SELECT *  

FROM students  

WHERE students_name IN ( Amit , Raghav, Rajeev) 

    Let’s take another example with numeric values.

    SELECT *  
    
    FROM marks  
    
    WHERE roll_no IN (001, 023, 024);

    Comments

    Leave a Reply

    Your email address will not be published. Required fields are marked *