![]() |
|
|||||||
![]() |
|
|
Thread Tools | Display Modes |
|
#1
IP: 174.128.225.240
|
|||
|
|||
|
How do a I list all tables containing a given column name?
I found there are several tables have the same field name, called: product_id. Any method to find all tables that contain product_id? |
|
#2
IP: 174.128.225.240
|
|||
|
|||
|
You can use the INFORMATION_SCHEMA database and the COLUMNS table in particular Example of use:
Code:
SELECT
table_name,
column_name,
data_type,
ordinal_position
FROM INFORMATION_SCHEMA.COLUMNS
WHERE table_schema = 'myDatabase' --- the database you want to search
AND column_name = 'name' ; --- or: column_name LIKE '%name%'
Code:
SELECT
table_name,
column_name,
data_type,
ordinal_position
FROM INFORMATION_SCHEMA.COLUMNS
WHERE table_schema = 'cheap_eyeglasses' --- the database you want to search
AND column_name = 'product_id' ; --- or: column_name LIKE '%name%'
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| how to find and replace a word in a mysql column? | Maribel | MySQL | 1 | 2015-12-19 11:02 PM |
| 3.1正式版QQ互联 Unknown column 'conuintoken' in 'field list' | 国际贸易 | Discuz/SupeSite/X-Space | 0 | 2013-12-22 09:32 AM |
| List of free and paid CMS scripts | car | 代码交流 | 0 | 2008-02-24 10:37 PM |
| List of Forums without NoFollow Signature Links | yahoo | 网站链接开发 | 1 | 2007-08-26 06:31 AM |
| List of high paying Keywords whose cpc is greater than $20 | sunshine | Google Adsense | 1 | 2007-05-09 08:16 PM |