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

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

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

—— 完 ——
  • 数据库索引
  • ToroDB和YugabyteDB的区别
  • [Warning] 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'E RROR_FOR_DIVISION_BY_ZERO'
  • C#防SQL注入帮助类
  • SQL ASCII() 函数
  • 数据库Mysql基本操作命令
  • SQL2008清除日志方法
  • SQL Server 查询所有可用的数据库
  • 下列建设工程施工信息内容中,属于施工记录信息的是( )。
  • Sql Server更改端口后如何连接

© CopyRight 2014~2024 薄学网.