zoukankan      html  css  js  c++  java
  • 1030 回顾

    昨日回顾

    1.单表的操作

    分组

    group by
    select * from 表名 group by 分组段名
    

    聚合函数

    1.count
        select count(id) from xx group by gender
    
    2.having
        select count(id) from xx group by gender having count(id)>23;
    
    3.order by
        升序 : sdc	order by id asc;
        降序 : desc	order by id desc;
        多列分组 : 先根据前一个排序,再根据后面的排序
        
    4.limit
        limit offset,size
            offset: 行数据索引
            size: 取多少行数据
    
    先后数据: 
    	where > group by > having > order by >limit
    

    2.多表操作

    外键

    constraint 随意的外键名 foreign key (表中的字段) references 引用的表(表的字段)
    

    一对多

    有外键的是多,多的一方设置外键
    

    多对多

    
    

    一对一

    新建一个id对应数值
    

    多表联查

    left join

    左连接

    select * from 表1 left join 表2 on 表1.段1 = 表2.段2;
    
    后面可加条件判断,where,group by,
    

    right join

    右链接

    
    

    inter join

    内连接

    
    
  • 相关阅读:
    linux ps查看进程命令
    linux distribution是什么?
    samba配置smb.conf
    linux samba.tar.gz安装和配置
    linux后台执行命令&
    linux crontab任务调度的使用
    linux ubuntu卸载软件
    vue-router
    vue computed
    vue 监听的使用
  • 原文地址:https://www.cnblogs.com/fwzzz/p/11779549.html
Copyright © 2011-2022 走看看