1、为选出的数据加一列固定值
select ‘kk’ as name from table;
2、在选择出的数据中进行判断,如果为1 则输出男性,如果为2 则输出女性
select (case when sex=1 then '男' when sex='2' then '女' end)as sex from table;
3.在一个区间内进行取值
where value between 1 and 3
4.将表2的数据拷贝到表1里面,如果表1有则更新,没有就插入
merge into 表1 t1
using(select id from 表2)t2
on(t2.id=t1.id)
when matched then
update set t1.name=t2.name
when not matched then
insert(t1.name)values(t2.name)