Now has three table t1, t2, t3, structure is id, name, an emp. Please use an insert statement, the t1 table data is inserted into the t2 id=1, the id=2 in the table data is inserted into the t3, please write the insert statement.
CodePudding user response:
This problem is to take an examination of you INSERT ALL syntax,The answer is as follows:
INSERT ALL
The WHEN ID=1 THEN
INTO T2
The ELSE
INTO T3
SELECT ID, NAME, EMP
The FROM T1
WHERE ID IN (1, 2);