zoukankan      html  css  js  c++  java
  • 2017-3-10 SQL server T-sql语句 高级查询

    条件修改:
    update 表名 set 列名 = 值 where 列名 = 值
    条件删除:
    delete from 表名 where 列名 = 值
    高级查询
    条件查询
     查列 *改为要查看的列,多列逗号隔开
     筛选条件 where 列名 = >= <= > < 值 and or
    模糊查询
    select * from 表名 where 列名 like '%值%' %通配符
    排序查询
    select * from 表名 where order by 列名 asc / desc
    去重查询
    select distinct 列名 from 表名
    分组查询
    select 某一列名 from 表名 group by 对应的列名
    子查询
    将查询语句当做值来使用

    子句的查询结果必须是一列
    子句可以返回多行数据,但必须是一列

    关键字:in  , not in,between   and  (相当于>=;<=) ,any(任一),all(全部)。

    alter table 外键表名 add constraint 约束名称 foreign key(外键字段) references 主键表名(约束列名)

    如表A中的Ids是主键,要约束表B中的Aid列,那么语句应该是:

    alter table B add constraint A_B_Ids foreign key(Aid) references A(Ids)

  • 相关阅读:
    Moving Price and Standard Price
    Partner function解析
    [ABAP] ABAP中定义和呼叫宏
    ABAP
    Words Learning~~(1-3)
    Words Learning~~(1-2)
    Words Learning~~(1-1)
    SQLSERVER如何查看索引缺失
    Material Stock manage T-code
    远程重启
  • 原文地址:https://www.cnblogs.com/zhengqian/p/6534358.html
Copyright © 2011-2022 走看看