StudentCodingHUB

Use programming to create innovative things.
  • new post

    Saturday, 9 May 2015

    Select Into in mysql

    Select Into

    SELECT INTO has two different parts:
    First, it creates the new table with the columns corresponding to the columns listed in the SELECT list. Second, it inserts the existing rows of the original table into the new table.

    USE sample;
    SELECT emp_no, emp_fname, emp_lname, dept_no
    INTO employee_enh
    FROM employee;


    ALTER TABLE employee_enh
    ADD domicile CHAR(25) NULL;

    SELECT INTO generates the employee_enh table
    inserts all rows from the initial table (employee) into the new one

    ALTER TABLE statement appends the domicile column to the employee_enh table.


    No comments:

    Post a Comment