不同数据SQL对比
有时候我们只想查看一下表的数据的前几行数据,如果不加限制条件的话,默认会查询整个表的数据,等待时间比较久。下面是不同数据库select语句显示前N行数据比对:
SQL Server
select top 10 * from table_name;
DB2
select * from table_name fetch first 10 rows only;
Oracle
select * from table_name where rownum <=10;
MySQL
select * from table_name limit 10;
Informix
select first 10 * from table_name;
Teradata数据仓库
select * from table_name sample 10;
sqlite3
select * from QGNe where (dg is null or dg=0) and lx=1 order by random() limit 6