Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • SQL In statement

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 180
    Comment on it

    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)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: