如何将第三个字段和第四个字段对掉?
我的oracle数据库中第三个字段名称为s3,第四个字段名称为s4,
我想把包括字段名s3在内第三个字段的所有内容和字段四s4中的内容对掉。
请问什么sql语句可以实现?
不胜感谢!
问题点数:20、回复次数:4Top
1 楼bzszp(SongZip)回复于 2002-11-12 10:15:37 得分 0
对掉?什么意思?Top
2 楼snowy_howe(天下有雪)回复于 2002-11-12 10:20:23 得分 8
如果是8i以下版本的话,只能用:
1、create table temp(....s4,s3,...) as select ...s3,s4,....from...
2、drop table 旧表
3、create table 旧表名 as select * from temp
Top
3 楼bzszp(SongZip)回复于 2002-11-12 10:25:27 得分 4
楼上的第三步可以这样
3、rename temp to oldtbname;Top
4 楼csdnqq(秋秋)回复于 2002-11-12 11:15:06 得分 8
oracle 文档:
Rename a Database Object Example To change the name of table dept to emp_dept, issue the following statement:
RENAME dept TO emp_dept;
You cannot use this statement directly to rename columns. However, you can rename a column using this statement together with the CREATE TABLE statement with AS subquery. The following statements re-create the table static, renaming a column from oldname to newname:
CREATE TABLE temporary (newname, col2, col3)
AS SELECT oldname, col2, col3 FROM static;
DROP TABLE static;
RENAME temporary TO static;Top
相关问题
- 请问:一张表有三个字段,每个字段的行都可能有重复的值,但三个字段的行不会复重。
- 我的表里有三个字段,我想让头二个字段为主键怎么作,谢谢
- 超难度:---这样的SQL操作怎么实现??(三个字段)
- 请问在SQL SERVER 中如何用查询语言删除PPPP字段中的后三个字符‘123’
- 有三个dbedit分别对应数据表(dbf)的三个字段,如何让三个有运算关系?
- access数据库中三个字段名ABC,我想A的默认值为B+C可以嘛?
- access库的表中,三个字段,类型int,想得到max-min的值,如何处理?(up有分)
- 为什么我从数据库中取记录时最多只取两个字段,多于三个字段则报错
- 如何将表单字段转化为 sql的numeric类型?如何将年月日三个字段转化为sql的日期类型?
- 内嵌select语句为何只能读取两个字段的内容,如果三个字段则报语法错误,为何?




