zoukankan      html  css  js  c++  java
  • DQL数据查询语言

    --查询全表
    select * from t_hq_ryxx;

    --查询字段
    select xingm as 姓名 ,gongz as 工资 from t_hq_ryxx;

    --链接字段查询
    select xingm || xingb as 姓名性别 from t_hq_ryxx

    --去除重复查询
    select distinct bumbm from t_hq_ryxx;

    --排序查询 desc 降序 asc升序
    select * from t_hq_ryxx order by bumbm desc;

    --组合排序查询 nulls first 空值排序在前 nulls last 空值排序在后
    select bumbm as 部门编码,t.* from t_hq_ryxx t order by xingb desc,bumbm
    nulls first;

    --数字代表字段列表序号
    select * from t_hq_ryxx order by 4;

    --组合、表达式排序查询
    select * from t_hq_ryxx order by xingm || xingb;

    --where条件查询
    select * from t_hq_ryxx where xingb = 1 and bumbm = 103;

    select * from t_hq_ryxx where bumbm is not null;

    select * from t_hq_ryxx where bumbm in (103,104,106);

    select * from t_hq_ryxx where gongz between 3000 and 4000;

    --模糊查询 % 任意位数通配符 _ 一位通配符
    select * from t_hq_ryxx where xingm like '%s%'

    select * from t_hq_ryxx where xingm like 'a_d'

    --子查询
    select * from t_hq_ryxx where bumbm in (select bumbm from t_hq_bm where dianh
    = '10086');

    --分组查询 group by 配合 having使用,进行过滤
    select bumbm,count(1) as 数量 , avg(gongz) as 平均工资 from t_hq_ryxx group by bumbm having avg(gongz)> 4000;

  • 相关阅读:
    iOS开发UI篇—Quartz2D使用(图片剪切)
    LeanCloud存取数据
    Pod搜不到类库解决办法
    第三方的工具以及插件
    苹果开发账号申请注意事项
    苹果账号网址汇总
    代码规范
    流媒体
    iOS面试题
    安装 Alcatraz
  • 原文地址:https://www.cnblogs.com/OldZhao/p/4914635.html
Copyright © 2011-2022 走看看