SELECT * FROM table_name LIMIT 0,20;
To display the top 20 rows in MySQL, you can use the LIMIT
clause in your query. Here’s the syntax:
SELECT * FROM your_table_name LIMIT 20;
Replace your_table_name
with the name of your table from which you want to retrieve the top 20 rows. This query will retrieve the first 20 rows from the table according to the default order (usually the order in which the rows were inserted). If you want to specify a different order, you can use the ORDER BY
clause along with LIMIT
. For example:
SELECT * FROM your_table_name ORDER BY column_name LIMIT 20;
Replace column_name
with the name of the column you want to order by. This query will retrieve the top 20 rows ordered by the specified column.