• Mysql学习(二)


    连接查询:

    1,连接上表     2,连接条件

    左连接:

    select 列1,…… from tableA left join tableB on tableA.列 = tableB.列 where group by,having 照常写

    [连接成一张大表后,可以当作一张表操作]

    slect goods_id , goods.cat_is,cat_name,shop_price from goods left join category  on goods.cat_id=category.cat_id

    右连接:

    select 列1,…… from tableA right join tableB on tableA.列 = tableB.列 where group by,having 照常写

    内连接:

    select 列1,…… from tableA inner join tableB on tableA.列 = tableB.列 where group by,having 照常写

    左连接、右连接和内连接的区别:

    左连接:以左表为准,去右表找匹配数据,找不到匹配的用NULL补齐;

    右连接:以右表为准,

    内连接:查询左右表都有的数据,即不用NULL的那一部分。

    触发器:trigger  监视某种情况触发某种操作;

    触发器创建语法四要素:1.监视地点(table) 2.监视事件(insert/update/delete) 3.触发时间(after/before) 4.触发事件(insert/update/delete)

    事务:

    开启事务 start transaction;

    执行sql语句

    提交事务 commit; / 回滚 rollback;

    「Stay Hungry. Stay Foolish.」
  • 相关阅读:
    自动化测试如何解决验证码的问题
    python读取xml文件
    python实现简单爬虫功能
    python使用mysql数据库
    Prometheus 到底 NB 在哪里?- 每天5分钟玩转 Docker 容器技术(84)
    Prometheus 架构
    数据收集利器 cAdvisor
    Weave Scope 多主机监控
    Weave Scope 容器地图
    监控利器 sysdig
  • 原文地址:https://www.cnblogs.com/Bluesgao/p/7611091.html
Copyright © 2020-2023  润新知