
- Learn MySQL
- MySQL - Home
- MySQL - Introduction
- MySQL - Installation
- MySQL - Administration
- MySQL - PHP Syntax
- MySQL - Connection
- MySQL - Create Database
- MySQL - Drop Database
- MySQL - Select Database
- MySQL - Data Types
- MySQL - Create Tables
- MySQL - Drop Tables
- MySQL - Insert Query
- MySQL - Select Query
- MySQL - Where Clause
- MySQL - Update Query
- MySQL - Delete Query
- MySQL - Like Clause
- MySQL - Sorting Results
- MySQL - Using Join
- MySQL - NULL Values
- MySQL - Regexps
- MySQL - Transactions
- MySQL - Alter Command
- MySQL - Indexes
- MySQL - Temporary Tables
- MySQL - Clone Tables
- MySQL - Database Info
- MySQL - Using Sequences
- MySQL - Handling Duplicates
- MySQL - SQL Injection
- MySQL - Database Export
- MySQL - Database Import
How to find tables with a specific column name in MySQL?
To find column names, use information_schema.columns. Following is the syntax −
select distinct table_name from information_schema.columns where column_name like '%yourSearchValue%' and table_schema=database();
Let us implement the above syntax in order to find column names across various table. Here, we want only table names with a specific column name word “Client” −
mysql> select distinct table_name from information_schema.columns where column_name like '%Client%' and table_schema=database();
This will produce the following output −
+----------------+ | table_name | +----------------+ | demotable449 | | demotable450 | | demotable461 | | demotable517 | | demotable529 | | demotable534 | | demotable537 | | demotable543 | | demotable547 | +----------------+ 9 rows in set (1.19 sec)
Now, let us check any of the table and look for word with “Client” column name −
- Related Articles
- Given a column name how can I find which tables in a MySQL database contain that column?
- Find a specific column in all the tables in a database?
- Fetch a specific column value (name) in MySQL
- Find records with a specific last digit in column with MySQL
- How to identify a column with its existence in all the tables with MySQL?
- How to find all tables that contains two specific columns in MySQL?
- How to get the primary key “column name” of a specific table in MySQL?
- How to select a column name with spaces in MySQL?
- How to find the name of a column in MySQL?
- How to combine two tables and add a new column with records in MySQL?
- MySQL random rows sorted by a specific column name?
- Find rows where column value ends with a specific substring in MySQL?
- Find specific records from a column with comma separated values in MySQL
- MySQL query to count rows with a specific column?
- How to get the count of a specific value in a column with MySQL?

Advertisements