Course Content

  • Tuple


Using a MySQL Database to Restrict Data Selections:

  • Assume we want to select all records in a table called "Orders" from 1 to 30 (inclusive). The SQL query would then be as follows: $sql = "SELECT * FROM Orders LIMIT 30"; The SQL query above returns the first 30 entries when executed.
#BBD0E0 »

The LIMIT clause in MySQL is used in conjunction with the SELECT statement to limit the number of rows returned in the result set. The Limit Clause accepts one or two offset and count arguments. Both arguments can have zero or positive integer values.

A SQL SELECT query with the ORDER BY clause returns a result set with the rows sorted by the values of one or more columns. Expressions like as column names, user-defined functions, arithmetic operations, and CASE expressions can be used as sort criteria.

The ORDER BY keyword in MySQL is:

  • To sort the result set in ascending or descending order, use the ORDER BY keyword. By default, the ORDER BY keyword organises the records in ascending order. Use the DESC keyword to sort the records in descending order.

The LIMIT clause in MySQL is used to limit the number of records returned. The LIMIT clause makes it simple to use SQL to define multi-page results or pagination, and it's very handy on large tables. A huge number of records returned can have an influence on performance.

Recommended Courses

Share With Friend

Have a friend to whom you would want to share this course?

Download LearnVern App

App Preview Image
App QR Code Image
Code Scan or Download the app
Google Play Store
Apple App Store
598K+ Downloads
App Download Section Circle 1
4.57 Avg. Ratings
App Download Section Circle 2
15K+ Reviews
App Download Section Circle 3
  • Learn anywhere on the go
  • Get regular updates about your enrolled or new courses
  • Share content with your friends
  • Evaluate your progress through practice tests
  • No internet connection needed
  • Enroll for the webinar and join at the time of the webinar from anywhere