查询某个字段存在于哪几个表

1.Oracle

select owner, table_name
from dba_tab_columns
where lower(column_name)='firstname';

 

2.mysql

USE information_schema;

SELECT `TABLE_NAME`

FROM `COLUMNS`

WHERE `COLUMN_NAME`='fid'

 

3.pgsql

SELECT 

  c.relname,

  col_description (a.attrelid, a.attnum) AS COMMENT,

  format_type (a.atttypid, a.atttypmod) AS TYPE,

  a.attname AS NAME,

  a.attnotnull AS notnull 

FROM

  pg_class AS c,

  pg_attribute AS a 

WHERE a.attrelid = c.oid 

  AND a.attnum > 0 

  AND a.attname = 'topic_id'

posted @ 2015-01-27 16:46  ZQH005  阅读(308)  评论(0)    收藏  举报