MySQL查询中间记录的方法


  本文标签:MySQL查询中间记录

  MySQL查询中间记录的方法并不复杂,下面就将为您举例说明MySQL查询中间记录的方法,如果您遇到过MySQL查询中间记录的问题,不妨一看  。

  查询表中前5条记录:

  1. select * from 表1 limit 5;  
  2.  
  3. select * from 表1 limit 0,5;  
  4.  

  
查询表中第5条到第7条记录:

  1. select * from 表1 limit 4,3;  
  2.  

  随即选取一个记录:

  1. select * from 表1 order by rand() limit 1;  
  2.  

  随即选取n条记录:

  1. select * from 表1 order by rand() limit n;  
  2.