insert all

来源:互联网 发布:6x6摇头矩阵灯 编辑:程序博客网 时间:2024/05/01 17:08

TABLE A: STUDENT、GRADE
TABLE B: STUDENT、TYPE
TABLE C: STUDENT、SCORE


现在要将C表中所有学生的SCORE 存入A表中,当TYPE为 a时 GRADE=SCORE*0.5,TYPE为b时,GRADE=SCORE*0.4,TYPE为c时,GRADE=SCORE*0.3
这个SQL语句要怎么写

 

SQL> INSERT ALL
 
2    WHEN type='a' THEN INTO tableA values(student,score*0.5)
 
3    WHEN type='b' THEN INTO tableA VALUES (student, score*0.5)
 
4    ELSE INTO tableA VALUES(student, score*0.3)
 
5    select c.student,c.score,b.type from TABLEC c,TABLEB b where c.student=b.student;