avatar
I*A
1
如果有一个table books,怎么知道这个table有哪些columns, what is the key, etc?
avatar
o*o
2
desc books;

etc?

【在 I**A 的大作中提到】
: 如果有一个table books,怎么知道这个table有哪些columns, what is the key, etc?
avatar
I*A
3
huh?
i only know "desc" is used to sort the rows.
it can do this too?
what is the output of it?

【在 o*o 的大作中提到】
: desc books;
:
: etc?

avatar
c*o
4
you can try
show columns in table_name, for more information check the following page
http://dev.mysql.com/doc/refman/5.0/en/show-columns.html
there should be one column which is designed for the keys

etc?

【在 I**A 的大作中提到】
: 如果有一个table books,怎么知道这个table有哪些columns, what is the key, etc?
avatar
t*a
5
show create table books;
avatar
d*e
6
Oracle:
最简单是 desc books,
或者 select * from user_tab_columns where table_name = 'BOOKS' 会详细一些。
key之类,可以用这个
select b.constraint_name, b.column_name, b.position
from user_constraints a, user_cons_columns b
where a.constraint_name = b.constraint_name
and a.table_name = 'BOOKS'
order by b.constraint_name, b.column_name, b.position;
其它的database,我想也有类似的

etc?

【在 I**A 的大作中提到】
: 如果有一个table books,怎么知道这个table有哪些columns, what is the key, etc?
avatar
I*A
7
thank you all..
"user_tab_columns" is a keyword?

【在 d**e 的大作中提到】
: Oracle:
: 最简单是 desc books,
: 或者 select * from user_tab_columns where table_name = 'BOOKS' 会详细一些。
: key之类,可以用这个
: select b.constraint_name, b.column_name, b.position
: from user_constraints a, user_cons_columns b
: where a.constraint_name = b.constraint_name
: and a.table_name = 'BOOKS'
: order by b.constraint_name, b.column_name, b.position;
: 其它的database,我想也有类似的

avatar
d*e
8
属于一个system view,对应login ID
原始应该是 all_tab_columns,column OWNER 可以指定谁的table

【在 I**A 的大作中提到】
: thank you all..
: "user_tab_columns" is a keyword?

avatar
I*A
9
en, this one would be the one that they want..

【在 c****o 的大作中提到】
: you can try
: show columns in table_name, for more information check the following page
: http://dev.mysql.com/doc/refman/5.0/en/show-columns.html
: there should be one column which is designed for the keys
:
: etc?

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。