I want to drop all tables that does not have rows.
How to drop all empty tables in SQLite?
EDIT
I need to do this on a mobile phone (no shell there). On a Windows Mobile phone.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Tables can be dropped, whether or not they have data in them when the command is executed. Dunno of any database that operates otherwise. So that means:
1) Getting a list of tables –
2) Iterate over that list, using COUNT(*) to determine if any rows exist within a table:
3) If the number returned is less than 1, execute a DROP statement:
SQLite doesn’t have function or stored procedure support – you’ll have to do this from your application.