Organizational Research By

Surprising Reserch Topic

oracle insert from select into table with more columns


oracle insert from select into table with more columns  using -'sql,oracle'

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?

Thank you!
    

asked Oct 7, 2015 by 20shahi
0 votes
5 views



Related Hot Questions

1 Answer

0 votes

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
answered Oct 7, 2015 by patelnikul321

...