Export DB tables with and without data

I have a database with approx 100 tables. I want to write a process that exports this database as a .sql file.

Easy enough right? Well… maybe not. I want some of the tables to export the data inside them, and other tables to export as empty with keys set to 0.

I’m using php but a ssh command would work fine as well.

Thanks in advance for any guidance or suggestions you may be able to provide.

It might be worth having a look at the mysqldump utility. This allows you to dump structure and data and allows a wealth of options. Although to get the flexibility you want you might need to execute it a number of times.

What if a different approach was used?

What if I just copied (and renamed) the entire database and ran ‘EMPTY’ on all the tables I wanted emptied?