列出特定的表的共同列 - Amazon Athena
Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅 中国的 Amazon Web Services 服务入门 (PDF)

列出特定的表的共同列

可以列出数据库中的特定的表的共同列。

  • 使用语法 SELECT column_name FROM information_schema.columns

  • 对于 WHERE 子句,请使用语法 WHERE table_name IN ('table1', 'table2')

例 – 列出同一个数据库中的两个表的共同列

如下示例查询列出了表 table1 和表 table2 的共同列。

SELECT column_name FROM information_schema.columns WHERE table_name IN ('table1', 'table2') GROUP BY column_name HAVING COUNT(*) > 1;