MySQL
七禾页丫
这个作者很懒,什么都没留下…
展开
-
MySQL学习笔记(5)
练习题目 每个部门薪水最高的员工 mysql> select e.ename, t.* -> from emp e -> join (select deptno, max(sal) as maxsal from emp group by deptno) t -> on e.deptno = t.deptno and e.sal = t.maxsal; +-------+--------+---------+ | ename | deptno |原创 2021-10-23 13:13:18 · 571 阅读 · 0 评论 -
MySQL学习笔记(4)
创建表 create table 表名 ( 字段1 数据类型, 字段2 数据类型 default 值, ...... ); 常见的约束: 非空约束(not null) 唯一约束(unique) 主键约束(primary key, PK) 外键约束(foreign key, FK) mysql> create table stu( -> id int primary key auto_increment, -> n..原创 2021-10-22 17:06:51 · 104 阅读 · 0 评论 -
MySQL学习笔记(3)
连接查询分类 内连接 (1)等值连接:等号连接 (2)非等值连接:除等号之外的操作符连接 (3)自连接:一张表当作多张表来连接 外连接 (1)左外连接:左表为主表,右表可能为null (2)右外连接:右表为主表,左表可能为null 全连接 内连接和外连接的区别是: 内连接:只显示两个表都匹配的数据(使用内连接会导致部分数据丢失) 左外连接:显示左表的全部数据(不管两个表是否匹配),右表中没有匹配的数据用null 右外连接:显示右表的全部数据(不管两个表是否匹配),左表中没有匹配的数据用null原创 2021-10-21 22:25:27 · 133 阅读 · 0 评论 -
MySQL学习笔记(2)
本学习笔记是根据动力节点教学总监杜老师的MySQL视频记录的,讲的很好,建议初学者跟视频学习原创 2021-10-21 10:56:59 · 110 阅读 · 0 评论 -
MySQL学习笔记(1)
1.登陆 C:\Users\12437>mysql -uroot -p Enter password: ****** Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 10 Server version: 8.0.25 MySQL Community Server - GPL Copyright (c) 2000, 2021, Oracle and/or its affili.原创 2021-10-20 16:42:59 · 89 阅读 · 2 评论