views:

35

answers:

2

My query is "select column_name,table_name from information_schema.columns". This query returns a number of columns and tables. Now, I want to determine the name of the database that corresponds to the returned table names. How do I accomplish this?

A: 
select database();

Is that it? The current schema?

Rafael Belliard
+2  A: 
mysql> describe information_schema.columns;
+--------------------------+
| TABLE_CATALOG            |
| TABLE_SCHEMA             | <=== this one (schema == database)
| TABLE_NAME               |
| COLUMN_NAME              |
.......
Wrikken
na.fa