Get a list of MySQL tables
February 14, 2009If you ever need to access the system wide schema info for a MySQL server, check out this very nice diagram of the MySQL Information_Schema.
What can you do with this information? Well, lots of stuff. For example you can get a list of tables and columns for a particular database, like
SELECT table_name, column_name, data_type [,...]
FROM information_schema.columns
WHERE table_schema = dbname;
Which could be handy for any number of reasons, such as seeing if a table or exists or if a column exists in a table, etc.
Posted by admin
