`

[Teach Youself SQL in 10 Minutes] inserting data

    博客分类:
  • db
DB2 
阅读更多

 1. Inserting Retrieved Data

INSERT INTO Customers(cust_id,

    cust_contact,

    cust_email,

    cust_name,

    cust_address,

    cust_city,

    cust_state,

    cust_zip,

    cust_country)

SELECT cust_id,

    cust_contact,

    cust_email,

    cust_name,

    cust_address,

    cust_city,

    cust_state,

    cust_zip,

    cust_country

FROM CustNew;

 

The SELECT statement used in an INSERT SELECT can include a WHERE clause to filter the data to be inserted.

 

Column Names in INSERT SELECT This example uses the same column names in both the INSERT and SELECT statements for simplicity's sake. But there is no requirement that the column names match. In fact, the DBMS does not even pay attention to the column names returned by the SELECT. Rather, the column position is used, so the first column in the SELECT (regardless of its name) will be used to populate the first specified table column, and so on.

 

2. Copying from One Table to Another

SELECT *

INTO CustCopy

FROM Customers;

 

Not Supported by DB2

 

分享到:
评论

相关推荐

    Sams Teach Youself SAP in 24 Hours(sap基础教程英文原版)

    Sams Teach Youself SAP in 24 Hours(sap基础教程英文原版)

    Teach Youself UML in 24 Hours

    10. **UML工具**:学习UML时,你可能会使用各种建模工具,如IBM Rational Rose、Enterprise Architect、Visual Paradigm等,这些工具可以帮助你绘制和管理UML模型。 通过这24小时的学习旅程,你将深入理解UML的各个...

    UML 24小时入门 Teach youself UML in 24 hours 3rd edition

    ### UML 24小时入门知识点详解 #### 一、UML概述 - **定义**:UML(Unified Modeling Language,统一建模语言)是一种标准化的可视化建模语言,广泛应用于软件工程领域,用于描述系统架构、设计模式及业务流程等。...

    Teach.Youself.Perl.5.in.21.Days

    《教你21天学会Perl 5》是一本旨在帮助初学者快速掌握Perl编程语言的经典教程。Perl 5是Perl编程语言的一个主要版本,以其强大的文本处理能力、灵活的语法和广泛的用途而闻名。这本书通过21天的学习计划,将Perl 5的...

    21天学通c++teacher youself in21days

    《21天学通C++ Teacher Yourself in 21 Days》是一本专为初学者设计的C++编程教程,旨在帮助读者在短短三周内掌握C++基础。这本书以实践为导向,通过逐步引导的方式,让学习者每天都能接触到新的概念和技术,从而在...

    21天学通Java【第六版】源代码

    国外经典Java教材,Sams Teach Youself Java in 21 Days第六版的源代码,本书涉及Java7和Android的知识,帮助读者编写高效的Java程序和Android应用! 作者:Rogers 译者:冯志祥等 出版社:人民邮电出版社

    java源码书籍-TeachYourselfJavaScriptIn24_4th:JavaScript入门经典(第4版)(SamsTeachY

    10. **实战项目**:通过实际的小型项目,比如计时器、图片轮播、表单验证等,帮助读者巩固所学知识并提高实践能力。 这本书作为开源资源,意味着读者可以免费获取并学习,同时也可以查看和贡献源码,这对于初学者来...

    Borland C++ 3.0自学培训教程 PDF格式

    这是SAMS Teach youself boorland C++Builder in 21 days一书的源代码,中文名Borland C++Builder3.0自学培训教程(希望公司出版).但此中文版并未配源码,使自学大打折扣.现在我把这套源码放在这,希望有这本书的读者能...

    傅里叶变换库函数FFTW

    Here are FFTW lib and dll files compiled by GCC4.5 and VC2010 in Win7. But I suggest you compiling it by youself in you computer, or there will be some unpredictable errors!

    Another JQuery Grid Plugin —— MagicGrid 插件

    3.load data from local and remote 4.row definition by youself (Render) 5.succinct code (size of origin code is under 10k, after compress it is under 3k), update easily. 6.easy study and use 7.easy...

    Login Control

    10. Now you are ready to use the control in your Web form. Just drag the LoginControl icon in the ToolBox pane and drop it to the Web form. The control should appear in the form with all its child ...

    JAVA_learn_by_youself.rar_Java编程_Java_

    "JAVA_learn_by_youself.rar" 这个压缩包文件就是专为那些想要踏上Java编程旅程的人准备的一份宝典。它包含了"JAVA 自学之路指南.doc",这份文档将是你学习Java的重要参考资料。 首先,让我们深入理解Java编程的...

    SEOFor2016TheCompleteDoItYourselfSEOGuide.pdf 英文原版

    SEO For 2016 – The Complete Do It Yourself SEO Guide

    app lock to lock apps

    app lock for you to lock youself apps which you can not see for others

    Android代码-ViewAniamtion

    This is a library of the AnimatorSet,it has three move path and many animation,you can make a easy animation of view by youself. animation of View i did not finish it at this time Demo MovePath ...

    易语言5.11完美破解

    Extract to any folder, and you can use it, make youself happy:) THIS IS A THIRD-PARTY SOFTWARE. IT IS PROVIDED "AS IS", WITHOUT ANY WARRANTY. If it does not meet your needs, please install the full ...

    如何编写批处理文件批处理文件批处理文件

    简明批处理教程22009年10月20日 星期二 下午 05:35 最近对于批处理技术的探讨比较热,也有不少好的批处理程序发布,但是如果没有一定的相关知识恐怕不容易看懂和理解这些批处理文件,也就更谈不上自己动手编写了,古...

    RC LOGGERSTATION-RC飞机的GPS数据记录仪-项目开发

    "rc-loggerstation-gps-data-logger-for-rc-plane-3ea4cd.pdf"可能是一份详细的项目指南或报告,包含了硬件组装步骤、软件配置以及数据分析方法。这将是理解整个项目的关键文档。 最后,"SSD1306Ascii"可能是一个与...

Global site tag (gtag.js) - Google Analytics