Skip to content
Advertisement

How to check if mysql table is empty?

How to check if my table is empty from C#?

I have something like:

Or I don’t need to call SELECT statement?

Advertisement

Answer

You can use COUNT(*) with no WHERE close and see if exactly how many rows exist with the result.

Or you can do a SELECT (id) FROM tablename with no WHERE clause and if no rows are returned then the table is empty.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement