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

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 201
    Comment on it

    SQL Update statement is used to modify the records in table in database . We can modify either by change data or deleting data or to update the existing data .
    We can modify the rows based on condition and condition come with where clause .
    Syntax :

    update table_name set column_name = value1 ,............column_nameN = valueN , where clause ;
    

    Example :

    Table name : Employee_Info

     Employee_name            Employee_Age          Employee _Salary
          Mukesh                  23                           100000
          Ayush                   24                           200000
          Ishan                   20                           400000
          Pranav                  35                           700000
          Abhishek                26                           800000
          Ravi                    25                           300000
          David                   40                           800000
    

    If i want to update the salary of Mukesh then you can use below query :

    update Employee_Info set Employee_Salary = ' 900000 ' where Employee_name = ' Mukesh ' ;
    

    Output :

     Employee_name            Employee_Age          Employee _Salary
          Mukesh                  23                         **900000** // After updation
          Ayush                   24                           200000
          Ishan                   20                           400000
          Pranav                  35                           700000
          Abhishek                26                           800000
          Ravi                    25                           300000
          David                   40                           800000
    

    Using this statement we can update multiple column also , see below :

    update Employee_Info set Employee_Salary = ' 10,00000 ' , Employee_Age = ' 40 ' where Employee_name = ' Abhishek ' ;
    

    Output :

     Employee_name            Employee_Age          Employee _Salary
          Mukesh                  23                           100000
          Ayush                   24                           200000
          Ishan                   20                           400000
          Pranav                  35                           700000
          Abhishek                **40**                     **10,00000** // After updation
          Ravi                    25                           300000
          David                   40                           800000
    

 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: