zoukankan      html  css  js  c++  java
  • 一、数据

    一、将数据清空(删除begin_date列的数据,使之为空)

    update test set begin_date=null;
    

     

    二、将列名删除(删除begin_date列,使之在表中不存在)

    alter table test drop column begin_date;

    三、修改列类型

    alter table Tbl_LoanAid alter column GuaranteeMoneyAmount float(53) --float, double 是近似存储,并不精确
    
    alter table Tbl_LoanAid alter column GuaranteeMoneyAmount decimal(18,4)--代表有4位小数,14位整数 凡是跟钱相关的都需要使用 Decimal(Decimal 是精确存储)。

     decimal(18,4)  float(53) 

    四、子查询(where、from、exists)

    where型:把内层查询的结果,作为外层查询的比较条件。

    查询最贵商品;where构造的是条件

    from型:把内层的查询结果当做外层的临时表,供外层sql再次查询

    查询每个栏目下最新和最贵商品;from构造的是表

    exists:把外层的查询结果拿到内层,看内层查询是否成立

    查询所有商品的栏目;

    注意:from型,供外层sql再次查询,供字表现很好,意思内层查询结构固定,再次查询的结果仅在词表呢。

    四、SQL SERVER 2005新加了 NEWSEQUENTIALID(),这是个内置函数,不能用与 SELECT

    -- 创建的表加约束 default newsequentialid()
    create table #t
    (
        id uniqueidentifier not null  default newsequentialid()
        ,name varchar(100)
    )
    go
    
    --插入表100条数据,并且要指定列名
    insert into #t(name) values('a')
    go 100
    
    select * from #t

  • 相关阅读:
    Linux Ctrl+Z的使用方法
    ImageView android:tint
    vim recording的使用方法
    java多态实现原理
    Java 修饰符
    Java 变量类型
    Java 对象和类
    Java内存结构详解
    一维数组
    数组
  • 原文地址:https://www.cnblogs.com/fger/p/10750884.html
Copyright © 2011-2022 走看看