almost 5 years ago
Active records provide us with ways to set constraints in our queries to specify the order in which we have to get the records from the table.
This can be done through the following ways:
This method is used to get records from the table in a specific order like this
or we can also write
This method will get us the users in the order they were created.
We can also refine the ordering in by putting in more constraints like this
This will get the users in ascending order of when they were created.
and this will get the users in descending order of when they were created.
The limit allows us to set the limit to the records which have to be fetched from the table like this
This will get the first 10 records from the user table as right now no offset has been put to the limit method.
The offset method allows us to specify that from which particular order number do we need the records.
This will fetch 10 users from the user table whose order will be starting from 26th record.
Starting with Chrome version 45, NPAPI is no longer supported for Google Chrome. For more information, see Chrome and NPAPI (blog.chromium.org).
Firefox and Microsoft Internet Explorer are recommended browsers for websites using java applets.
Chrome Version Support
Are you sure, you want to delete this comment?
Terms of Service
| © copyright 2021 FindNerd.com. All rights reserved.
Sign up using