mysql:
select count(*) from main_index;
但是這個在這里卻報語法錯誤。
第一種方法:
查文檔得:
Aggregate functions (AVG(), MIN(), MAX(), SUM()) in column list clause are supported. Arguments to aggregate functions can be either plain attributes or arbitrary expressions. COUNT(*) is implicitly supported as using GROUP BY will add @count column to result set. Explicit support might be added in the future. COUNT(DISTINCT attr) is supported. Currently there can be at most one COUNT(DISTINCT) per query and an argument needs to be an attribute. Both current restrictions on COUNT(DISTINCT) might be lifted in the future.
也就是說只有在group by的時候才能用count(*),如:
下面我們來說一下show meta:
SHOW META shows additional meta-information about the latest query such as query time and keyword statistics:
也就是說它顯示的是最近一次查詢附加的一些信息,比如查詢時間、關鍵字統計、總記錄等。