Collections:
Returning Top 5 Rows in MySQL
How To Return Top 5 Rows in MySQL?
✍: FYIcenter.com
If you want the query to return only the first 5 rows, you can use the LIMIT clause, which takes one parameter as the maximum number of rows to return. The following statement returns the first 5 rows from the fyi_links:
mysql> SELECT id, url, counts, tag FROM fyi_links ORDER BY counts DESC LIMIT 5; +-----+-------------------+--------+------+ | id | url | counts | tag | +-----+-------------------+--------+------+ | 107 | www.winrunner.com | 8 | SQA | | 105 | www.oracle.com | 7 | DBA | | 103 | sqa.fyicenter.com | 6 | SQA | | 101 | dev.fyicenter.com | 4 | DEV | | 106 | www.php.net | 4 | DEV | +-----+-------------------+--------+------+ 5 rows in set (0.00 sec)
⇒ Returning the Second 5 Rows in MySQL
⇐ Counting Groups Returned from GROUP BY in MySQL
2017-12-21, 2662🔥, 0💬
Popular Posts:
What Are the Underflow and Overflow Behaviors on FLOAT Literals in SQL Server Transact-SQL? If you e...
How To Connect the Oracle Server as SYSDBA in Oracle? This is Step 4. The best way to connect to the...
How To Change the Password for Your Own User Account in MySQL? If you want to change the password of...
How To Create a Table Index in Oracle? If you have a table with a lots of rows, and you know that on...
What Privilege Is Needed for a User to Delete Rows from Tables in Another Schema in Oracle? For a us...