[size=x-large][color=red]1.连接列值:[/color][/size]
DB2,Oracle使用||作为连接运算符。
MySQL使用concat函数
SQL Server使用"+"号作为连接运算符
[size=x-large][color=red]2.限制返回的行数:[/color][/size]
DB2 :
MySQL :
Oracle:
[size=x-large][color=red]3.从表中随机取出5条记录:[/color][/size]
DB2 :
MySQL :
Oracle:
DB2,Oracle使用||作为连接运算符。
select ename || 'works as a' || job as msg from emp where deptno='10'
MySQL使用concat函数
select concat(ename,'works as a',job) as msg from emp where deptno='10'
SQL Server使用"+"号作为连接运算符
select ename + 'works as a' + job as msg from emp where deptno='10'
[size=x-large][color=red]2.限制返回的行数:[/color][/size]
DB2 :
select * from emp fetch first 5 rows only
MySQL :
select * from emp limit 5
Oracle:
select * from emp where rownum < 5
[size=x-large][color=red]3.从表中随机取出5条记录:[/color][/size]
DB2 :
select * from emp order by rahnd() fetch first 5 rows only
MySQL :
select * from emp order by rand() limit 5
Oracle:
select * from ( select ename , job from emp order by dbms_random.value() ) where rownum < =5 ;