View Single Post
  #2   IP: 174.128.225.240
Old 2015-12-22, 04:56 AM
Third Lake Third Lake is offline
初级会员
 
Join Date: 2010-08-15
Posts: 1
Third Lake 现在声名狼藉
Default

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%'
say, you want to check a database called cheap_eyeglasses, here is your MySQL command:
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%'
Reply With Quote