Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get Top 5 records in SqLite?

Tags:

select

sqlite

I have tried this which did not work.

select top 5 * from [Table_Name] 
like image 692
Amitabh Avatar asked Apr 28 '10 11:04

Amitabh


People also ask

How do I limit the number of rows returned?

You use the LIMIT clause to constrain the number of rows returned by the query. For example, a SELECT statement may return one million rows. However, if you just need the first 10 rows in the result set, you can add the LIMIT clause to the SELECT statement to retrieve 10 rows.

How do I get ascending order in SQLite?

It allows you to sort the result set based on one or more columns in ascending or descending order. In this syntax, you place the column name by which you want to sort after the ORDER BY clause followed by the ASC or DESC keyword. The ASC keyword means ascending. And the DESC keyword means descending.

How do I use wildcards in SQLite?

SQLite LIKE examplesTo find the tracks whose names start with the Wild literal string, you use the percent sign % wildcard at the end of the pattern. To find the tracks whose names end with Wild word, you use % wildcard at the beginning of the pattern.


1 Answers

SELECT * FROM Table_Name LIMIT 5; 
like image 183
Nix Avatar answered Sep 28 '22 14:09

Nix