In SQL Database " In " is used as a operator. It help user to reduce the " OR " statements, means In operator avoid multiple statements .
It is used withe select , insert , update or delete statements only .
Advantage ->
It reduce the " or " operators .
Syntax ->
Expression In ( value 1 , value 2 ............ value N ) .
Example ->
Table name : student 
    Student_name            Student_Age          Student_Id
        Mukesh                  23                 1
        Ayush                   24                 2
        Ishan                   20                 4
        Pranav                  35                 7
        Abhishek                26                 8
        Ravi                    25                 3
  suppose i want to select multiple name from this table. If i use " or " operator then i have to write multiple statements and from " in " operator i can do this with one statement only like this, see below ->
select * from student where Student_name in ( Mukesh , Ayush , Ishan ) ; // Output -> it return 3 row with all data . 
If i do this work for numeric value then we  can  also do ->
select * from student where Student_Id ( 7 , 8 , 3 ) // Output -> it also return 3 row with all data .
                       
                    
0 Comment(s)