开发者

Is there a built-in way to count records in a SQLite table?

I'm looking for something "a little bit faste开发者_JS百科r" than doing SELECT * FROM table_name and stepping through all the records...


SELECT COUNT(*) FROM table_name

Jaw dropping, eh? :)


Use the COUNT aggregate function:

SELECT COUNT(*) AS numRecords
  FROM YOUR_TABLE

I defined the column alias "numRecords" to make it easier to isolate the value you want to retrieve.


Try SELECT COUNT(*) FROM table_name;

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜