select from one table, insert into another table oracle sql query

前端 未结 4 726
礼貌的吻别
礼貌的吻别 2020-12-29 06:00

I am trying to select data from one table
and insert the data into another table

    SELECT ticker FROM tickerdb;

Using OracleSql I am

相关标签:
4条回答
  • 2020-12-29 06:28

    You will get useful information from here.

    SELECT ticker
    INTO quotedb
    FROM tickerdb;
    
    0 讨论(0)
  • 2020-12-29 06:35

    From the oracle documentation, the below query explains it better

    INSERT INTO tbl_temp2 (fld_id)
    SELECT tbl_temp1.fld_order_id
    FROM tbl_temp1 WHERE tbl_temp1.fld_order_id > 100;
    

    You can read this link

    Your query would be as follows

    //just the concept    
        INSERT INTO quotedb
        (COLUMN_NAMES) //seperated by comma
        SELECT COLUMN_NAMES FROM tickerdb,quotedb WHERE quotedb.ticker = tickerdb.ticker
    

    Note: Make sure the columns in insert and select are in right position as per your requirement

    Hope this helps!

    0 讨论(0)
  • 2020-12-29 06:47

    You can use

    insert into <table_name> select <fieldlist> from <tables>
    
    0 讨论(0)
  • 2020-12-29 06:47

    try this query below:

    Insert into tab1 (tab1.column1,tab1.column2) 
    select tab2.column1, 'hard coded  value' 
    from tab2 
    where tab2.column='value';
    
    0 讨论(0)
提交回复
热议问题