avatar
as
1
建好一个TABLE之后,可以再加一列吗?
可以改这个TABLE的名字吗?
avatar
l*u
2
呵呵,加一列是没问题的,改名字嘛...没试过,哪位指导一下?

【在 as 的大作中提到】
: 建好一个TABLE之后,可以再加一列吗?
: 可以改这个TABLE的名字吗?

avatar
c*h
3

copy the table and assign it with another name.

【在 l***u 的大作中提到】
: 呵呵,加一列是没问题的,改名字嘛...没试过,哪位指导一下?
avatar
as
4

谢了,仔细读了一遍USER's GUIDE, 发现用ALTER可以
加一列,或改名。我用的是POSTGRESQL。

【在 c********h 的大作中提到】
:
: copy the table and assign it with another name.

avatar
u*e
5
You can add a fresh column, but this column must be "NULL".
You can not change the table's name.

【在 as 的大作中提到】
: 建好一个TABLE之后,可以再加一列吗?
: 可以改这个TABLE的名字吗?

avatar
d*d
6

Sure he can, just create a new table (with the new name)
with all the columns and rows of the previous table.
Then delete the old table.
just simple like mv command in unix

【在 u**e 的大作中提到】
: You can add a fresh column, but this column must be "NULL".
: You can not change the table's name.

avatar
k*n
7

In MS SQLServer,you can use
alter table to add a column and use
sp_rename to rename the table name

【在 as 的大作中提到】
: 建好一个TABLE之后,可以再加一列吗?
: 可以改这个TABLE的名字吗?

avatar
as
8

In postgresql user's guide, I found:
ALTER TABLE name1 ADD COLUMN name2 type
or
ALTER TABLE name1 RENAME TO name2

【在 k***n 的大作中提到】
:
: In MS SQLServer,you can use
: alter table to add a column and use
: sp_rename to rename the table name

avatar
l*u
9

POST-GRE-SQL是在美国读博士需要考的SQL吗,呵呵...

【在 as 的大作中提到】
:
: In postgresql user's guide, I found:
: ALTER TABLE name1 ADD COLUMN name2 type
: or
: ALTER TABLE name1 RENAME TO name2

avatar
q*j
10
alter table

【在 as 的大作中提到】
: 建好一个TABLE之后,可以再加一列吗?
: 可以改这个TABLE的名字吗?

avatar
f*s
11
哈哈

【在 l***u 的大作中提到】
:
: POST-GRE-SQL是在美国读博士需要考的SQL吗,呵呵...

avatar
B*n
12
In oracle:
suppose you already have a table EMP(name Varchar2(30), salary Number);
and you want to add a column called 'id', just do:
SQL> ALTER TABLE EMP ADD (id Number);
if you now want to populate this id column from 1 to the number of existing
employees in the EMP table, just do:
SQL> UPDATE EMP SET id = rownum;
To rename table 'EMP' to 'EMPLOYEE', just do:
SQL> RENAME EMP TO EMPLOYEE;

【在 as 的大作中提到】
: 建好一个TABLE之后,可以再加一列吗?
: 可以改这个TABLE的名字吗?

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