How to select rows with a LIMIT clause

The syntax of the LIMIT clause

      LIMIT [rowOffset, ] maxRows;
      

Retrieve the first three rows of the result set

      SELECT productID, productName 
      FROM products 
      LIMIT 3;
      
limit image

Another way to retrieve the first three rows

      SELECT productID, productName 
      FROM products 
      LIMIT 0, 3;
      
limit 3 rows image

Retrieve three rows starting at the second row

      SELECT productID, productName 
      FROM product 
      LIMIT 1, 3;
      
2nd 2 rows image

Description

Back