I have tried this which did not work.
select top 5 * from [Table_Name] I have tried this which did not work.
select top 5 * from [Table_Name] An equivalent statement would be
select * from [TableName] limit 5 TOP and square brackets are specific to Transact-SQL. In ANSI SQL one uses LIMIT and backticks (`).
select * from `Table_Name` LIMIT 5; Select TableName.* from TableName DESC LIMIT 5 DESC. Has no effect.The selected answer works, EXCEPT when you need to add a where clause. If you need a where clause and still need to limit that where clause to the top 5 records, then you need to create a subselect like the following.
Why? because in my case the where-clause excludes some of the top 5 records. You still get a limit of 5 records, but they won't be the first 5 records.
SELECT sum(quantity) as total FROM ( SELECT quantity, weight FROM mytable order by id limit 5 ) AS T where weight > 2 Replace only YOUR table name[TABLE_NAME] and use.
"select * from "+TABLE_NAME+ " LIMIT " +5;