SQL 如何列出 Netezza 中的所有列名称?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/30607280/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-01 03:41:26  来源:igfitidea点击:

How do I list all the column names in Netezza?

sqlnetezza

提问by Courtney

Is there a query I can write to search all the column names for a particular database in Netezza?

是否可以编写查询来搜索 Netezza 中特定数据库的所有列名?

回答by Niederee

Within the same database you can use the following query:

在同一个数据库中,您可以使用以下查询:

select *
from _v_odbc_columns1
where column_name like '%columnname%'

or a less Netezza specific query

或较少的 Netezza 特定查询

select *
from information_schema.columns
where column_name like '%columnname%'

回答by karthik G

The important catalog views in netezza system are listed below

下面列出了 netezza 系统中的重要目录视图

  • _V_USER: the user view gives information about the users in the netezza system.
  • _V_TABLE: the table view contains the list of tables created in the netezza performance system.
  • _V_RELATION_COLUMN: the relation column system catalog view contains the columns available in a table.
  • _V_TABLE_INDEX: this system catalog contains the information about the indexes created on table. netezza does not support creating indexes on a table as of now.
  • _V_OBJECTS: lists the different objects like tables, view, functions etc. available in the netezza.
  • _V_USER:用户视图提供有关 netezza 系统中用户的信息。
  • _V_TABLE:表视图包含在 netezza 性能系统中创建的表的列表。
  • _V_RELATION_COLUMN:关系列系统目录视图包含表中可用的列。
  • _V_TABLE_INDEX:此系统目录包含有关在表上创建的索引的信息。截至目前,netezza 不支持在表上创建索引。
  • _V_OBJECTS:列出了 netezza 中可用的不同对象,如表、视图、函数等。

Example:

例子:

SELECT * 
FROM _V_RELATION_COLUMN
WHERE
    ATTNAME like '%GEO%' --SPECIFY COLUMN NAME
    AND type = 'TABLE'

回答by J_Arthur

You would access something similar to an information_schema. Column Name, %COW%', would use % as a wildcard...gathering any column that has 'COW' in the name

您将访问类似于 information_schema 的内容。列名 %COW%' 将使用 % 作为通配符...收集名称中包含 'COW' 的任何列

SELECT * 
FROM _V_SYS_COLUMNS 
WHERE 
COLUMN_NAME like '%COW%' 
AND TABLE_SCHEMA = 'DEV' 
ORDER BY TABLE_NAME 
;