Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I want to show all tables that have specified column name

How can I get a list of all the tables that have a specific column name?

like image 884
Alex Gordon Avatar asked Nov 16 '10 18:11

Alex Gordon


People also ask

How do I find a particular column name in all tables in MySQL?

How to list all tables that contain a specific column name in MySQL? You want to look for tables using the name of columns in them. SELECT DISTINCT TABLE_NAME FROM INFORMATION_SCHEMA. COLUMNS WHERE COLUMN_NAME IN('column1', 'column2') AND TABLE_SCHEMA = 'schema_name';

How can I find a particular column name within all tables in hive?

Here's the query you can use on the metastore: select TBL_NAME, COLUMN_NAME, TYPE_NAME from TBLS left join COLUMNS_V2 on CD_ID = TBL_ID where COLUMN_NAME like 'column'; where 'column' is the column name you're looking for.

How can we find any table name using a column name?

USE YourDatabseName GO SELECT t.name AS table_name, SCHEMA_NAME(schema_id) AS schema_name, c.name AS column_name FROM sys. tables AS t INNER JOIN sys. columns c ON t.

How do I find a particular column name in all tables in Oracle?

select table_name from all_tab_columns where column_name = 'PICK_COLUMN'; If you've got DBA privileges, you can try this command instead: select table_name from dba_tab_columns where column_name = 'PICK_COLUMN'; Now if you're like me, you may not even know what the column you're searching for is really named.


2 Answers

Pretty simple on a per database level

Use DatabaseName Select * From INFORMATION_SCHEMA.COLUMNS Where column_name = 'ColName' 
like image 130
Evidica Avatar answered Sep 22 '22 11:09

Evidica


select table_name from information_schema.columns where COLUMN_NAME = 'MyColumn' 
like image 20
D'Arcy Rittich Avatar answered Sep 18 '22 11:09

D'Arcy Rittich