zoukankan      html  css  js  c++  java
  • MySQL加强

    MySQL加强

    Default

    Not null

    Unique

    Primary key

    Zerofill primary key auto_increment

    primary key auto_increment

    constraint 主表_副表_pk foreign key (id) reference 主表 (id);

    constraint 主表_副表_pk foreign key (id) reference 主表 (id)on update cascade on delete cascade 级联修改 级联删除

    delimiter$

    create procedure

    begin

    declare

    end$

    第一范式 每个字段不可分割

    第二范式 每个字段都和主键有依赖

    第三范式 除了主键之外都和主键有直接依赖关系

    内连接:

           Select * from a,b where a.id = b.id

           Select * from a where inner join b on a.id = b.id

    左外连接、右外连接

           Select * from a left outer join b on a.id = b.id

           --以左边的表为主表 进行展示  可以展示null

    Call 存储过程名称 –调用

    查看所有全局变量 show variables

    查看某个全局变量 show @@变量名

    修改全局变量  set 变量名 = 值

    会话变量 set @变量名 = 值

    查看会话变量 select @变量名

    Create trigger tri_名字 after update on 表名 for each row

           Insert into 记录表 values(‘内容’);

    --修改密码

    Update user set password = password(‘新密码’) where user=’用户’

    --分配权限

    Grant select on 数据库.表名 to ‘用户’@‘localhost’identified by ‘密码’;

    简单点,不行么?!
  • 相关阅读:
    #455. 【UER #8】雪灾与外卖
    lmh's邻位交换总结
    [ARC088C] Papple Sort
    【模板】二次剩余
    P3241 [HNOI2015]开店
    P4248 [AHOI2013]差异
    P6640 [BJOI2020] 封印
    【笔记】牛客、产品笔试题
    【笔记】TX笔试-压缩算法
    【笔记】分组
  • 原文地址:https://www.cnblogs.com/core404/p/5771505.html
Copyright © 2011-2022 走看看