
1、首先打开mysql,连接一个数据库,点击上方的【查询】按钮,再点击【新建查询】,如图所示。
2、在查询框中,输入sql语句“EXPLAIN select * from users”,前面加了EXPLAIN,则查询语句在执行时,会记录执行过程效率。
3、在查询框中,输入sql语句“EXPLAIN select * from users”,前面加了EXPLAIN,则查询语句在执行时,会记录执行过程效率。
4、然后看到结果1那一栏,可以看到,查询的表是【users】,查询类型是【SIMPLE】,type是【all】,因为用了“select *”语句。
5、最后一栏显示的是【状态】,即表示一些执行的状态,如接收到的字节数,值是多少;发送的字节数,值是多少等。
数据库的随机查询SQL1. Oracle,随机查询20条
select * from
(
select * from 表名
order by dbms_random.value
)
where rownum <= 20
2.MS SQL Server,随机查询20条
select top 20 * from 表名order by newid()
3.My SQL:,随机查询20条
select * from 表名 order by rand() limit 20
1、Oracle查询结果集,随机排序
select * from tableName order by dbms_random.value()2、MySQL随机查询,随机排序
SELECT * FROM tableName ORDER BY rand()3、SQL随机查询,随机排序
SELECT * FROM tableName ORDER BY NEWID()4、Oracle随机查询20条
select * from(
select * from tableName order by dbms_random.value
)
where rownum <= 20
5、My SQL随机查询20条
select * from tableName order by rand() limit 206、MS SQL Server随机查询20条
select top 20 * from tableName order by newid()欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)