as 发帖数: 5 | 1 建好一个TABLE之后,可以再加一列吗?
可以改这个TABLE的名字吗? |
l***u 发帖数: 157 | 2 呵呵,加一列是没问题的,改名字嘛...没试过,哪位指导一下?
【在 as 的大作中提到】 : 建好一个TABLE之后,可以再加一列吗? : 可以改这个TABLE的名字吗?
|
c********h 发帖数: 191 | 3
copy the table and assign it with another name.
【在 l***u 的大作中提到】 : 呵呵,加一列是没问题的,改名字嘛...没试过,哪位指导一下?
|
as 发帖数: 5 | 4
谢了,仔细读了一遍USER's GUIDE, 发现用ALTER可以
加一列,或改名。我用的是POSTGRESQL。
【在 c********h 的大作中提到】 : : copy the table and assign it with another name.
|
u**e 发帖数: 177 | 5 You can add a fresh column, but this column must be "NULL".
You can not change the table's name.
【在 as 的大作中提到】 : 建好一个TABLE之后,可以再加一列吗? : 可以改这个TABLE的名字吗?
|
d**d 发帖数: 20 | 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.
|
k***n 发帖数: 12 | 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的名字吗?
|
as 发帖数: 5 | 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
|
l***u 发帖数: 157 | 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
|
q*j 发帖数: 156 | 10 alter table
【在 as 的大作中提到】 : 建好一个TABLE之后,可以再加一列吗? : 可以改这个TABLE的名字吗?
|
f****s 发帖数: 10 | 11 哈哈
【在 l***u 的大作中提到】 : : POST-GRE-SQL是在美国读博士需要考的SQL吗,呵呵...
|
B*****n 发帖数: 135 | 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的名字吗?
|