有表:
name fenshu
张三 89
李四 92
王五 79
现想插入一列,变为:
name fenshu age
张三 89 18
李四 92 17
王五 79 17
插入的这一列可以通过select语句从另外的表中得到,
本人刚学sql语句,只知道insert是插入行,不知道怎样插入列,
请各位不吝赐教!
name fenshu
张三 89
李四 92
王五 79
现想插入一列,变为:
name fenshu age
张三 89 18
李四 92 17
王五 79 17
插入的这一列可以通过select语句从另外的表中得到,
本人刚学sql语句,只知道insert是插入行,不知道怎样插入列,
请各位不吝赐教!
解决方案 »
- 错误ORA-12545: Connect failed because target host or object does not exist
- 关于oracle下载的问题
- 各位帮忙指点下学习道路!
- 数据库sql问题
- 日期处理,着急!
- oracle 触发器的问题 请高手
- vc6+oracle如何动态连接数据库??
- 客户端是采用delphi的ado连接,请问是否可以不安装ORACLE客户端连接到ORACLE服务器端?????
- 跪求 李兴华老师 2014版的 Oracle笔记!!!!!!(SOS)
- oracle数据库,在表空间创建用户,设置密码为什么不能是数字
- 在线求救 解决了马上给分!!!
- 求一条查询语句
update 表1 set age=(select age from 表2 where 表1.字段1=表2.字段1)
where exists(select 1 from 表2 where 表1.字段1=表2.字段1)
然后再插入数据:update table_name set age=18 where name='张三';
update table_name set age=17 where name='李四';
update table_name set age=17 where name='王五';
drop table 表1
create table 表1 as select col1,col2,col3 from 表2 where ...
表2里只有age这个字段,没有前两列,所以上面的好像不行
create view v_name as select a.name,a.fenshu,b.age from table_1 a,table_b where
或者把view改成table,然后把原来的table删掉,把现在的v_name 改名成原来的table就可以了
alter talbe tableName add age number(3);
2.update table1 set age=(select ......)
update 目标表 a
set age = (select age from 源表 b where a.字段=b.字段)
where exists (select 1 from 源表 b where a.字段=b.字段)
update table a
set age=(select age from table b where a.字段=b.字段)
where exists (select 1 from table b where a.字段=b.字段)