Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • SQL Mid ( ) Function

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 206
    Comment on it

    This function is used to get the character from a text field .
    Syntax In MySQL :

    select mid ( column_name , start [ starting_length , ending_length ] ) from table_name ;
    

    Starting length : It is mandatory .
    Ending length : It is optional . If you omit the ending length then it will return entire length of that character .
    Syntax in SQL :

    select substring ( column_name , start , length ) from table_name ;
    

    Example :
    Table name : Employee_Info

      Id        Employee_name          Employee_Age               Employee _Salary
      1            Mukesh                  23                           100000
      2            Ayush                   24                           200000
      3            Ishan                   20                           400000
      4            Pranav                  35                           700000
      5            Abhishek                26                           800000
      6            Ravi                    25                           300000
      7            David                   40                           800000
    

    Query to extract substring from original string .

    select mid ( Employee_name , 1 , 3 ) from Employee_Info ;
    

    Output :

     Employee_name
      Muk
      Ayu
      Ish
      Pra
      Abh
      Rav
      Dav
    

 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: