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

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

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

—— 完 ——
  • MYSQL连接Error (1133): Can’t find any matching row in the user table错误的解决办法
  • C# .NET 获取日期是第几周
  • 关系型数据库的产品有哪些?
  • Teradata和CouchDB的区别
  • SQL CURSOR_STATUS() 函数
  • SQL 3NF第三范式
  • 数据库Mysql基本操作命令
  • MSSQL如何查看当前连接和未结束的事务?
  • 计算sql语句执行时间
  • mysql修改字段类型和字段长度

© CopyRight 2014~2024 薄学网.