Import data from one table to other in MYSQL

Below is the MYSQL query which can be used to import bulk data from one table to other table.
The code below also shows the implementation of CASE statement in MYSQL queries

 
QUERY:

INSERT INTO TABLE1
(
 id,empname,emppwd,empsal,empstatus
)
SELECT id,ename,epwd,

  CASE UPPER(TRIM(level))
    WHEN 'LEVEL I' THEN 150000
    WHEN 'LEVEL II' THEN 200000
    WHEN 'LEVEL III' THEN 300000
  END,
  1
  FROM TABLE2;

No comments:

Post a Comment