Question

What is the best way to see a sample of all your databases and tables in one query?

For example: while (show databases) { foreach database_name (select * from table_name limit 2)};

[Test_DB] Test_DB.one

+---------------+--------------+
| ip            | tstamp       |
+---------------+--------------+
| 192.168.10.10 | 01/13/2013   |
| 192.168.10.11 | 01/14/2013   |
+---------------+--------------+

[Test_DB] Test_DB.two

+----------------+--------------+
| mac            | tstamp       |
+----------------+--------------+
| dead.beef.cake | 01/13/2013   |
| dead.beef.cake | 01/14/2013   |
+----------------+--------------+
Was it helpful?

Solution

For a quick list you can do this:

SELECT TABLE_SCHEMA AS _db, TABLE_NAME AS _table FROM information_schema.tables

You'll have to wrap something around that to do the SELECT * ... LIMIT 2 part.

OTHER TIPS

"select * from [Test_DB] Test_DB.one inner join [Test_DB] Test_DB.two limit 2" try this

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top