Oracle从select插入到具有更多列的表中 [英] Oracle insert from select into table with more columns

查看:65
本文介绍了Oracle从select插入到具有更多列的表中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从select语句插入到表中,但是,从select语句返回3列,并且该表有4列,我想为额外列中的所有行添加0.谁能给我一个示例SQL查询吗?

I want to insert to a table from a select statement, however, there are 3 columns returned from the select statement and the table has 4 columns, I would like to add 0 for all rows in the extra column. Can anyone give me a sample SQL query for that?

谢谢!

推荐答案

只需在您选择的内容中添加"0"即可.

Just add in the '0' in your select.

INSERT INTO table_name (a,b,c,d)
    SELECT
       other_table.a AS a,
       other_table.b AS b,
       other_table.c AS c,
       '0' AS d
    FROM other_table

这篇关于Oracle从select插入到具有更多列的表中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆