什么是SQL查询?

时间:2017-09-09 20:53:20

标签: sql database db2

Price   Age     Name
3000    30  Ram
2000    20  Ram
1000    10  Ram
5000    40  Sham
6000    50  Sita

编写Sql查询并将输出显示为

Price   Age     Name
1000    30  Ram
5000    40  Sham
6000    50  Sita

2 个答案:

答案 0 :(得分:2)

text

答案 1 :(得分:0)

这很简单:

select 1000 as price, 30 as age, 'Ram' as name from sysibm.sysdummy1
union all
select 5000 as price, 40 as age, 'Sham' as name from sysibm.sysdummy1
union all
select 6000 as price, 50 as age, 'Sita' as name from sysibm.sysdummy1
order by 1;

(如果您希望查询从表中读取数据,但会产生相同的结果,则必须定义要应用的规则。)