在一个查询中查看所有数据库和表的示例的最佳方法是什么?
例如: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 |
+----------------+--------------+
答案 0 :(得分:0)
“select * from [Test_DB] Test_DB.one内部联接[Test_DB] Test_DB.two limit 2” 试试这个
答案 1 :(得分:0)
如需快速列表,您可以执行以下操作:
SELECT TABLE_SCHEMA AS _db, TABLE_NAME AS _table FROM information_schema.tables
你必须用它来包装它来做SELECT * ... LIMIT 2
部分。