This query gives all the column names from all the databases.
SELECT *
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = N'Customers'
But I need to get all the column names from a table from a specific database. Because I have multiple tables with the same name. How to do that? Is there anything like
SELECT *
FROM INFORMATION_SCHEMA.COLUMNS
WHERE DATABASE_NAME = 'database_name' TABLE_NAME = 'table_name'
I am using xampp server and phpMyAdmin.
3
Answers
This is the SQL for my expected result
Quote the fine manual:
..you should see it when you do
SELECT *
?You want something like this.
The MySQL INFORMATION_SCHEMA uses columns named
TABLE_SCHEMA
to hold the database for each table.