• 温故知新——简单知识点


    知识点一、

    1 (1)INSERTINTO SELECT语句
    2 语句形式为:Insert into Table2(field1,field2,...) select value1,value2,... from Table1
    3 要求目标表Table2必须存在,由于目标表Table2已经存在,所以我们除了插入源表Table1的字段外,还可以插入常量。
    4
    5 (2)SELECTINTO FROM语句
    6 语句形式为:SELECT vale1, value2 into Table2 from Table1
    7 要求目标表Table2不存在,因为在插入时会自动创建表Table2,并将Table1中指定字段数据复制到Table2中。

    知识点二、

    1 将一张表的一列数据更新到另一表的一列:
    2 (1)条件假设,tab1(ID,数据列),tab2(ID,数据列)
    3 (2)语句:update b
    4 set b.数据列=a.数据列 from tab2 a
    5 inner join tab1 b on a.ID=b.ID

    知识点三、

    (1)查询中你会用到的 
    select [Name] from 你的数据库名..sysobjects WHERE [type] IN (N'U')
    注意:".."别弄丢了
    (2)查找表中所有的列名
    a).select name from syscolumns where id=object_id('表名')
    b).select count(*) from syscolumns where id=object_id('表名')
    以下是oracle中用的
    1.select column_name,data_type from user_tab_columns where table_name = 'SZKB' order by data_type
    2. SELECT COLUMN_NAME ,data_type FROM USER_TAB_COLS WHERE TABLE_NAME = 'SZKB' order by data_type
    3. select column_name from user_tab_columns where table_name = 'HLGA' order by data_type



     

  • 相关阅读:
    mysql数据库备份脚本
    int main(int argc,char *argv[])参数的应用
    文件I/O实现cp复制功能
    网络通信TCP编程实例代码
    外部碎片、进程描述符、内部碎片
    程序、进程、作业、线程的关系
    word2016怎么从第三页开始设置页码
    ARMs3c2440开发板挂接NFS服务
    u-boot添加一个hello命令
    vi 编辑器跳转到指定行数
  • 原文地址:https://www.cnblogs.com/gtzhou/p/2181931.html
Copyright © 2020-2023  润新知