336
votes

I have tried this which did not work.

select top 5 * from [Table_Name]
7

7 Answers

619
votes
SELECT * FROM Table_Name LIMIT 5;
45
votes

An equivalent statement would be

select * from [TableName] limit 5

http://www.w3schools.com/sql/sql_top.asp

32
votes

TOP and square brackets are specific to Transact-SQL. In ANSI SQL one uses LIMIT and backticks (`).

select * from `Table_Name` LIMIT 5;
32
votes
select price from mobile_sales_details order by price desc limit 5

Note: i have mobile_sales_details table

syntax

select column_name from table_name order by column_name desc limit size.  

if you need top low price just remove the keyword desc from order by

31
votes
select * from [Table_Name] limit 5
5
votes
Select TableName.* from  TableName DESC LIMIT 5
-1
votes

Replace only YOUR table name[TABLE_NAME] and use.

"select * from "+TABLE_NAME+ " LIMIT " +5;