Just wanted to know doesn't the use of "LIMIT 1 " optimise it. select count(*) from component where category='natural' limit 1
... Chetana. ----- Original Message ---- From: Igor Tandetnik <[EMAIL PROTECTED]> To: SQLite <sqlite-users@sqlite.org> Sent: Sunday, November 5, 2006 5:28:23 AM Subject: [sqlite] Re: Re: Testing For Empty Table Rich Shepard <[EMAIL PROTECTED]> wrote: > I want the latter case. In other words, if there are no records > where 'category = "natural"' nothing should be returned. It would be > nice if there was a return value that told me explicitly "no records > match the where". You could write select exists (select * from component where category='natural'); This produces a singleton result (single row, single column). The only cell of this result contains integer 1 if there are indeed rows with category='natural' in table component, and 0 if there are none. I still don't understand why you want to "look before you leap", so to speak. Why not just run the query select * from component where category='natural'; and handle the case where it produces an empty result set? Igor Tandetnik ----------------------------------------------------------------------------- To unsubscribe, send email to [EMAIL PROTECTED] -----------------------------------------------------------------------------