从数据库表中随机获取N条记录的SQL语句

2022-02-23 10:38:13 码农 1801

Oracle:

select * from (select * from tableName order by dbms_random.value) where rownum < N
MS SQLServer:

select top N * from tableName order by newid()
My Sql:

select * from tableName order by rand() limit N

—— 完 ——
  • 参与一个项目,你需要学习什么,记录什么?
  • 关于操作Access数据库时提示“标准表达式中数据类型不匹配”的问题
  • MySQL服务正在启动或停止中,请稍候片刻后再试一次
  • Sql使用Insert一条语句执行多条数据插入
  • mysql修改字段类型和字段长度
  • 备份mysql数据库报outfile disabled 错误
  • 注入语句:http://xxx.xxx.xxx/abc.asp?p=YY and user>0
  • Host "localhost " is not allowed to connect to mysql server解决办法
  • SQL Server游标的使用
  • SQL删除语句DROP、TRUNCATE、 DELETE 的区别

© CopyRight 2014~2024 薄学网.