深入SQL之 insert all
===========================================================
深入SQL之 insert all
===========================================================
用於網站資料遷移時,表之間的資料複製
INSERT ALL WHEN ottl 100000 and ottl 290000 THEN INTO special_orders SELECT o.order_id oid, o.customer_id cid, o.order_total ottl, o.sales_rep_id sid, c.credit_limit cl, c.cust_email cem FROM orders o, customers c WHERE o.customer_id = c.customer_id;
INSERT ALL WHEN ottl 100000 and ottl 290000 THEN INTO special_orders SELECT o.order_id oid, o.customer_id cid, o.order_total ottl, o.sales_rep_id sid, c.credit_limit cl, c.cust_email cem FROM orders o, customers c WHERE o.customer_id = c.customer_id;
Finally, the next example uses the FIRST clause to put orders greater than 2,900,000 into the special_orders table and exclude those orders from the large_orders table:
INSERT FIRST WHEN ottl 100000 and ottl 200000 THEN INTO large_orders VALUES(oid, ottl, sid, cid) SELECT o.order_id oid, o.customer_id cid, o.order_total ottl, o.sales_rep_id sid, c.credit_limit cl, c.cust_email cem FROM orders o, customers c WHERE o.customer_id = c.customer_id;上面的是兩個表中都插入了資料,
下面的是first插 special_orders,large_orders不再插入重複資料:p
aaa 評論於:2007.04.11 10:57
引文來源 王旺的書房 | 深入SQL之 insert all
Link URL: http://wworacle.blog.163.com/blog/static/21268725200849113958508
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/271063/viewspace-263478/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Oracle中的insert/insert all/insert firstOracle
- Oracle 的 INSERT ALL和INSERT FIRSTOracle
- INSERT ALL 和INSERT FIRST 的區別
- oracle insert all多表插入的示例Oracle
- Oracle批量插入資料insert all into用法Oracle
- 深入SQL之merge intoSQL
- SQL之19深入group bySQL
- SQL之18深入group bySQL
- SQL之17深入group bySQL
- sql入門之23 pivoting insert等SQL
- oracle insert all 特性-------9i開始Oracle
- SQL__INSERTSQL
- LINQ to SQL語句之Insert/Update/Delete操作SQLdelete
- 【SQL】9 SQL INSERT INTO 語句SQL
- SQL Server之深入理解STUFFSQLServer
- Oracle insert all一次插入多個表中Oracle
- SQL Union和SQL Union All用法(轉)SQL
- 用insert all實現同時向多表插入資料
- sql中union和union allSQL
- oracle sql tunning all hintsOracleSQL
- mybatis中insert into ...select ...from dual union all select ... from dual 提示sql命令未結束的問題MyBatisSQL
- Sql Server系列:Insert語句SQLServer
- SQL INSERT批次插入方式SQL
- 【SQL】 Multi table insert 多表插入操作SQL
- SQLite 之 INSERT OR REPLACE使用SQLite
- sql中union和union all的用法SQL
- ALL, ANY and SOME Comparison Conditions in SQLSQL
- Monitor All SQL Queries in MySQL (alias mysql profiler)MySql
- sql_union all_列別名SQL
- 【SQL】UNION ALL 與UNION 的區別SQL
- SQL UNION 和 UNION ALL 操作符SQL
- sql server merge 做insert和updateSQLServer
- sql中UNION和UNION ALL的區別SQL
- UNION效率比UNION ALL效率高——SQL優化之Everything is possibleSQL優化
- sql server 帶有OUTPUT的INSERT,DELETE,UPDATESQLServerdelete
- SQL Server Bulk Insert批量資料匯入SQLServer
- 【轉】UNION效率比UNION ALL效率高——SQL優化之Everything is possibleSQL優化
- All in one入門之All in one和三種PVE、ESXI、Windows Server方案WindowsServer