Monday, September 1, 2008

list of same column name from all the tables.

Hello Friend,
This time i'll tell you something about how we can know which table contains the same column name in a database.

[Note] This query only work in MySQL 5.02 and above

[Important]: - This query can help Ruby developer when they assigned a new project and if the project does not have a E-R diagram, As we never set a foreign key at a database level.
So here is the query

SELECT TABLE_NAME, COLUMN_NAME FROM information_schema.columns
WHERE COLUMN_NAME = user_id' AND table_schema = "test_development"

No comments: