Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Discussion on insert data using replace statement in Mysql

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 1.59k
    Comment on it

    Hi Reader's,
    Welcome to FindNerd, today we are going to discuss insert data using replace statement in Mysql

    Basically REPLACE INTO Statement is used for inserting a row in a table. If we want to replaces any record form our table then firstly old record will be delete and new record will be insert.

    So in other words we can say that REPLACE INTO Statement is similar to INSERT INTO statement but it does not allow duplicate row. Old row is deleted before the new row is inserted.

    We can see syntax and example below :

    REPLACE INTO tablename (column1, column2) VALUES( value1, value2);

    Example:

    REPLACE INTO Employee (name, country) VALUES ( 'Ankush', 'India');

    The above query will insert "Ankush" in name column and "India" in country column but if the same name and country are already present in the "User" table than it will replace the old one with the new one.

    I hope this blog will help you.

    Thanks

 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: