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

    设置主键语句

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

    点击确认后完成。

  • 相关阅读:
    库函数文件操作
    系统文件操作函数
    time函数
    字符(串)输入输出函数
    select&epoll
    epoll
    select
    Apache 配置虚拟主机三种方式
    Apache VirtualHost配置
    Scrapy中用xpath/css爬取豆瓣电影Top250:解决403HTTP status code is not handled or not allowed
  • 原文地址:https://www.cnblogs.com/LCL390/p/4077416.html
Copyright © 2011-2022 走看看