Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Copying Data from one table into another

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 700
    Comment on it

    INSERT INTO SELECT statement:

    INSERT INTO SELECT statement is used to copy data from existing table into another table.

    Syntax-1:

    INSERT INTO tablename2 SELECT * FROM tablename1;
    

    Syntax-2

    INSERT INTO tablename2 (columnname(s)) SELECT columnname(s) FROM tablename1;
    

    Example:

    INSERT INTO Employee (Name, City) SELECT StudentName, City FROM School; 
    

    This query will insert studentname and his respective city into Employee table from School table.

 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: