select from one table, insert into another table oracle sql query(从一个表中选择,插入到另一个表中 oracle sql 查询)
问题描述
我正在尝试从一张表中选择数据
并将数据插入到另一个表中
I am trying to select data from one table
and insert the data into another table
SELECT ticker FROM tickerdb;
我正在尝试使用 OracleSql
从tickerdb表中获取股票代码GOOG",
并将 t.ticker 插入到 stockdb 表中.
Using OracleSql I am trying to
get the ticker symbol "GOOG" from the tickerdb table,
and insert the t.ticker into the stockdb table.
从tickerdb表中选择-->插入到quotedb表中
select from tickerdb table --> insert into quotedb table
INSERT INTO quotedb
(t.ticker, q.prevclose, q.opn, q.rnge,
q.volume, q.marketcap, q.dividend, q.scrapedate)
VALUES (?,?,?,?,?,?,?,?,SYSDATE)
tickerdb t inner JOIN quotedb q
ON t.ticker = q.ticker
推荐答案
从 oracle 文档中,下面的查询更好地解释了它
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;
您可以阅读此链接
您的查询如下
//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
希望这有帮助!
这篇关于从一个表中选择,插入到另一个表中 oracle sql 查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:从一个表中选择,插入到另一个表中 oracle sql 查询


基础教程推荐
- 带更新的 sqlite CTE 2022-01-01
- MySQL根据从其他列分组的值,对两列之间的值进行求和 2022-01-01
- MySQL 5.7参照时间戳生成日期列 2022-01-01
- 如何在 CakePHP 3 中实现 INSERT ON DUPLICATE KEY UPDATE aka upsert? 2021-01-01
- CHECKSUM 和 CHECKSUM_AGG:算法是什么? 2021-01-01
- ORA-01830:日期格式图片在转换整个输入字符串之前结束/选择日期查询的总和 2021-01-01
- while 在触发器内循环以遍历 sql 中表的所有列 2022-01-01
- 带有WHERE子句的LAG()函数 2022-01-01
- 从字符串 TSQL 中获取数字 2021-01-01
- 使用 VBS 和注册表来确定安装了哪个版本和 32 位 2021-01-01