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

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 531
    Comment on it

    SELECT INTO Statement:

    SELECT INTO statement is used to copy data from one table into another table. We can provide a condition while using SELECT INTO statement.

    Syntax:

        SELECT columnname(s)
          INTO new_tablename
          FROM tablename
         WHERE EXISTS 
              (SELECT columnname
                 FROM tablename
                WHERE condition);

     

    Example:

        SELECT * INTO EMP
          FROM Employee
         WHERE City = 'Delhi';

    The above query will copy those employee records from Employee table into EMP table who belong to Delhi.

    Example for copying only selected columns:

    SELECT EmpName, Address
    INTO EMP
    FROM EMPLOYEE;

    This query copy only Employee Name and their addresses into EMP 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: