zoukankan      html  css  js  c++  java
  • 数据库(子查询、主键、外键)

    -------子查询------------
    select bumen,COUNT(*)as 人数 from haha group by bumen having COUNT(*)>=5
    select MAX(nianling) from haha where bumen='销售部'
    select *from haha where bumen='销售部'and nianling=56
    --汇总
    select *from haha where nianling = (
    select MAX(nianling) from haha where bumen in(
    select bumen from haha group by bumen having COUNT(*)>=5
    )
    )
    and bumen =(select bumen from haha group by bumen having COUNT(*)>=5)

    --查找男同志里面年龄最大的全部信息--
    select MAX(xingming) from haha where xingbie ='男'
    select *from haha where xingming =(select MAX(xingming) from haha where xingbie ='男')

    ---分页代码---,

    select top 5*from haha
    select top 5*from haha where code not in(select top 5 code from haha)

    --分页代码,前面top代表一页有多少条数据,后面代码是过滤当前页的前面页面的数据

    --查看一个表最多能分成多少页
    select ceiling(COUNT(*)/5.0)from haha

    设置主键语句

    关系-添加-表和列规范后面的省略号

    点击确认后完成。

  • 相关阅读:
    【转载】大型系统中使用JMS优化技巧
    【原创】JMS发布者订阅者【异步接收消息】
    【原创】JMS生产者和消费者【PTP异步接收消息】
    泛型
    For-Each循环
    策略模式(Strategy)
    Sort--快速排序
    Serach
    Sort--冒泡排序
    数值交换
  • 原文地址:https://www.cnblogs.com/LCL390/p/4077416.html
Copyright © 2011-2022 走看看