sql union

union可以最后加一行:

select fnumber ,fsalary from t_tempemploee
union
select '工资合计', sum(fsalary) from t_tempemploee;

可以打印5以内的平方

mysql:

select 1,1*1
union
select 2,2*2
union
select 3,3*3
union
select 4,4*4;

oracle:

select 1,1*1  from dual
union
select 2,2*2  from dual
union
select 3,3*3  from dual
union
select 4,4*4    from dual;

db2:

select 1,1*1  from sysibm.sysdummy1
union
select 2,2*2  from sysibm.sysdummy1
union
select 3,3*3  from sysibm.sysdummy1
union
select 4,4*4    from sysibm.sysdummy1;

 

上一篇:MySQL基础语法—(union联合查询)


下一篇:浅谈SQL中的UNION关键字