On 2/13/2012 11:20 AM, Kit wrote:
2012/2/13 Igor Tandetnik<itandet...@mvps.org>:
bhaskarReddy<uni...@gmail.com>  wrote:
        How to check whether a table is empty or not. If a table is empty, i
want to do some logic. If not another logic.

select exists (select 1 from MyTable);

SELECT exists(SELECT 1 FROM MyTable LIMIT 1);

exists() predicate is smart enough to stop as soon as the first row is retrieved. LIMIT 1 clause is redundant, though harmless.
--
Igor Tandetnik

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to