Info

此问题已关闭。 请重新打开它进行编辑或回答。

Can we see query fields in Workplace?

1 次查看(过去 30 天)
Nan Shen
Nan Shen 2013-1-23
关闭: MATLAB Answer Bot 2021-8-20
Can we also pull query fields into workplace when we query data? How to do it?
  5 个评论
Walter Roberson
Walter Roberson 2013-1-24
Could you give an example of what you would like to do?
Nan Shen
Nan Shen 2013-1-25
I use query builder to query data from our database. it pops up a variable with data I need. But what I also need are names of those columns (fields in Query Builder). Can we have another varible in workspace showing the field names? thanks!

回答(1 个)

the cyclist
the cyclist 2013-1-25
There is no way that I know of to return the column names along with the data of those columns. (It would be a bit odd to do so, since the names and data may be of different types.)
You can query the metadata of the database to get column names. For example, in postgresql you can write
SELECT attname , typname FROM pg_attribute , pg_type WHERE
typrelid=attrelid AND typname = 'table_name' ;
to find the columns for the table named table_name.

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by