列出所有列名 [英] list all column names
本文介绍了列出所有列名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
从 tbl 中选择 *
select * from tbl
有没有一种简单的方法可以列出表中的所有列名,看起来像这样?
Is there an easy way to list all the column names from the table that will look like this?
从tbl中选择colA、colB、colC
select colA, colB, colC from tbl
推荐答案
我不知道列出列名是什么意思.如前所述,要列出您需要编写的所有列中的数据:
I'm not sure what you mean by listing the column names. As already mentioned to list the data within all columns you'll need to write:
select * from table
然而,如果您只想要表格中的列的列表,请试试这些:
Whereas if you'd like a list of just the columns in your table, give these a try:
show columns from table
或
describe table
关于后者的更多信息可以在这里找到
More information on the latter can be found here
http://dev.mysql.com/doc/refman/5.0/en/show-columns.html
http://dev.mysql.com/doc/refman/5.0/en/describe.html
这篇关于列出所有列名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文