SQL语句的用法

目录

关系统型数据库相

联系类型

数据库的正规化分析

第一范式:1NF  范式主要就是减产冗余

第二范式:2NF

第三范式:3NF

 字符串(char,varchar,text)

char和varchar的比较:

修饰符, 主键,唯一键

常见命令 

 创建表:

借鉴一个老表创建一个新表,的两种方式

​编辑

增删改查 (批量导入)

增 删

在name下面增加phone文件

在下面增加内容

改 

查 

select的用法     

内连接  inner join

联合查询union

交叉连接等cross join

左外连接left outer join

 右外连接right outer join

取没有交际的表

完全外连接 

自连接, 即表自身连接自身 

三个表内连接查询

别名


关系统型数据库相

  • 关系Relational :关系就是二维表,其中:表中的行、列次序并不重要
  • 行row:表中的每一行,又称为一条记录record
  • 列column:表中的每一列,称为属性,字段,域
  • 主键Primary key只能有一个,内容不能相同
  •        复合主键: 多列表加起来生成的主键
  • 唯一键Unique key可以有多个 内容不能相同 空置可以null
  • 域domain :男女 年龄 0-150等

联系类型

  • 一对一联系(1:1): 在表A或表B中创建一个字段﹐存储另一个表的主键值 如: 一个人只有一个身份证
  • 一对多联系(1:n):外键, 如: 部门和员工
  • 多对多联系(m:n):增加第三张表, 如: 学生和课

数据库的正规化分析

目前关系数据库有六种范式:第一范式(1NF)、第二范式(2NF)、第三范式(3NF)、巴德斯科范式(BCNF)、第四范式(4NF)和第五范式(5NF,又称完美范式)。

满足最低要求的范式是第一范式(1NF)。在第一范式的基础上进一步满足更多规范要求的称为第二范式(2NF),其余范式以次类推。一般数据库只需满足第三范式(3NF)即可

  • 规则是死的,人是活的,所以范式是否必须遵守,要看业务需要而定
  • 掌握范式的目的是为了在合适的场景下违反范式
第一范式:1NF  范式主要就是减产冗余
  • 无重复的列,每一列都是不可分割的基本数据项,同一列中不能有多个值,即实体中的某个属性不能有多个值或者不能有重复的属性,确保每一列的原子性。除去同类型的字段,就是无重复的列
  • 说明:第一范式(1NF)是对关系模式的基本要求,不满足第一范式(1NF)的数据库就不是关系数据库
第二范式:2NF
  • 第二范式必须先满足第一范式,属性完全依赖于主键,要求表中的每个行必须可以被唯一地区分,通常为表加上每行的唯一标识主键PK,非PK的字段需要与整个PK有直接相关性,即非PK的字段不能依赖于部分主键
第三范式:3NF
  • 满足第三范式必须先满足第二范式属性,非主键属性不依赖于其它非主键属性。第三范式要求一个数据表中不包含已在其它表中已包含的非主关键字信息,非PK的字段间不能有从属关系    (这主要是为了防止数据冗余,与其非主键依赖关系不如在创一个表)

 字符串(char,varchar,text)

  • char(n) 固定长度,最多255个字符,注意不是字节
  • varchar(n) 可变长度,最多65535个字符
  • tinytext 可变长度,最多255个字符
  • text 可变长度,最多65535个字符
  • mediumtext 可变长度,最多2的24次方-1个字符
  • longtext 可变长度,最多2的32次方-1个字符
  • BINARY(M) 固定长度,可存二进制或字符,长度为0-M字节
  • VARBINARY(M) 可变长度,可存二进制或字符,允许长度为0-M字节
  • 内建类型:ENUM枚举, SET集合
char和varchar的比较:

char是指定大小,varchar是动态大小,char快,varchar节省空间,根据情况定义,如果字节大小类似可以varchat,

修饰符, 主键,唯一键

适用所有类型的修饰符:

NULL                       数据列可包含NULL值,默认值
NOT NULL              数据列不允许包含NULL值,相当于网站注册表中的 * 为必填选项
DEFAULT                默认值
PRIMARY KEY       主键,所有记录中此字段的值不能重复,且不能为NULL
UNIQUE KEY          唯一键,所有记录中此字段的值不能重复,但可以为NULL
CHARACTER SET name       指定一个字符集

适用数值型的修饰符:    auto_increment

AUTO_INCREMENT      自动递增,适用于整数类型, 必须作用于某个 key 的字段,比如primary key
UNSIGNED                   无符号

常见命令 

  •  status;               \s;              查看线程版本之类的 
  • show databases                  查看数据库
  • show tables;                        查看库里几个表
  • desc xxx;                             查看表格创建信息
  •  select * from students;       *代表着字段所有 查看所有表
  • select database();              查看当前数据库
  • select user();                      查看当前用户
  • show create table student;                            查看以前创建表用的命令
  • show table status like 'student'\G;                 查看表的详细信息存储过程,创建日期等
  • \G    竖过来显示

  • use mysql                        切换数据库
  • create database db1;       创建数据库
  •  drop table <表格名>        删除表格
  • drop database <数据库名>;    删除库

 创建表:

:  

CREATE TABLE student (                                            创建表,名字
id int UNSIGNED AUTO_INCREMENT PRIMARY KEY, 名字,4字,全整,自动增加,主键
name VARCHAR(20) NOT NULL,                                    名字,限长20,不能为空,
age tinyint UNSIGNED,                                                    年龄,1字节,取整(最大255)
#height DECIMAL(5,2),                     
gender ENUM('M','F') default 'M'         

enum 限定值的取值范围,比如(男,女,未知)等    ENUM('M','F') default 'M'    男或女,默认男
)AUTO_INCREMENT=10;                   自动增长默认10开始,

CREATE TABLE students (
id int UNSIGNED AUTO_INCREMENT PRIMARY KEY comment "学生编号",
name VARCHAR(20) NOT NULL,
age tinyint UNSIGNED,
#height DECIMAL(5,2),
gender ENUM('M','F') default 'M'
)AUTO_INCREMENT=10 ;

 insert student (name,age)values('xiaoming',20);      写入到student里数据,小明,20岁

comment ‘描述干什么的’                                   描述干什么的可以加在最后

列:   id int UNSIGNED AUTO_INCREMENT PRIMARY KEY comment "学生编号",

借鉴一个老表创建一个新表,的两种方式

  • create table custom like student;       
  • 创建一个新表借鉴一个老表,表格内容不会集成下来,但是格式规则都会继承下来

  • create table xxx as select * from students;   
  • 创建一个新表借鉴一个老表,内容都会继承下来,个别规则会丢掉,如自动递增,主键等

增删改查 (批量导入)

增 删

尽量不要跟更改表结构,容易出问题

在name下面增加phone文件
  • ALTER TABLE students ADD COLUMN phone varchar(11) AFTER name;
  • 更改,表格,    x,       增加  列     (创建名字) 最多位  谁的下面(name下面phone文件)
  • ALTER TABLE s1 DROP COLUMN mobile;  更改,表格,x,删除,列,x
#修改表名
ALTER TABLE students RENAME s1;
#添加字段
ALTER TABLE s1 ADD phone varchar(11) AFTER name;
#修改字段类型
ALTER TABLE s1 MODIFY phone int;
#修改字段名称和类型
ALTER TABLE s1 CHANGE COLUMN phone mobile char(11);
#删除字段
ALTER TABLE s1 DROP COLUMN mobile;
#修改字符集
ALTER TABLE s1 character set utf8;
#修改数据类型和字符集
ALTER TABLE s1 change name name varchar(20) character set utf8;
#添加字段
ALTER TABLE students ADD gender ENUM('m','f');
alter table student modify is_del bool default false;
#修改字段名和类型
ALETR TABLE students CHANGE id sid int UNSIGNED NOT NULL PRIMARY KEY;
#删除字段
ALTER TABLE students DROP age;
#查看表结构
DESC students;
#新建表无主键,添加和删除主键
CREATE TABLE t1 SELECT * FROM students
ALTER TABLE t1 add primary key (stuid);
ALTER TABLE t1 drop primary key ;
#添加外键
ALTER TABLE students add foreign key(TeacherID) references teachers(tid);
#删除外键
SHOW CREATE TABLE students #查看外键名
ALTER TABLE students drop foreign key <外键名>;

虽然有自动增长,但是如果不写的话,就需要,写清楚赋值对象  需要一一对应,一行也可以加多行记录

在下面增加内容

列:

  • insert into students value(26,'wei',18,'M',1,null);   
  • insert students set name='wsd',age=22,gender='M';   这样亦可以

insert students (name, age, gender) select name, age, gender from teachers 

把teachers的 name, age, gender 插入到students的最后面   

改 

update students set age=21,gender='F' where name='wei';

  • 把wei的年龄改成21,性别女,指定修改name=wei的    where指定
  • 也可以 where age >20;   把20岁以上的都改了

改后

 update students set teacherid=1 where TeacherID is null;

  • 把teacherid的空值(null)改为1 ,这里需要用is 不能用=;

delete from students where stuid=30;          删除指定行 

查 
select的用法     
  • 不能使用正则表达式,否则有的索引会失效

select * from students;   *代表着字段所有(就是把字段的所有内容打印粗来)可以把*换成列名

select 类似于echo有类似打印功能,如图;  如果后面跟文件名就是打印的行长

查看students表中年龄是10~20岁的stuid ,name,gender,age字段信息

  •  select stuid ,name,gender,age from students where age between 18 and 20;
  • select stuid ,name,gender,age from students where age >=18 and age <= 20;

  • order  by age;  从小到大排序
  • order  by age desc   排序从打到小
  • avg(age)  统计括号里的平均年龄
  • max(stuid)显示stuid最大值的编号
  • group by gender 分组
mysql> select stuid,name,gender,age from students;
+-------+---------------+--------+-----+
| stuid | name          | gender | age |
+-------+---------------+--------+-----+
|     1 | Shi Zhongyu   | M      |  22 |
|     2 | Shi Potian    | M      |  22 |
|     3 | Xie Yanke     | M      |  53 |
|     4 | Ding Dian     | M      |  32 |
|     5 | Yu Yutong     | M      |  26 |        查询students下的stuid,name,gender,age信息
|     6 | Shi Qing      | M      |  46 |
|     7 | Xi Ren        | F      |  19 |
|     8 | Lin Daiyu     | F      |  17 |
|     9 | Ren Yingying  | F      |  20 |
|    10 | Yue Lingshan  | F      |  19 |
|    11 | Yuan Chengzhi | M      |  23 |
|    12 | Wen Qingqing  | F      |  19 |
|    13 | Tian Boguang  | M      |  33 |
|    14 | Lu Wushuang   | F      |  17 |
|    15 | Duan Yu       | M      |  19 |
|    16 | Xu Zhu        | M      |  21 |
|    17 | Lin Chong     | M      |  25 |
|    18 | Hua Rong      | M      |  23 |
|    19 | Xue Baochai   | F      |  18 |
|    20 | Diao Chan     | F      |  19 |
|    21 | Huang Yueying | F      |  22 |
|    22 | Xiao Qiao     | F      |  20 |
|    23 | Ma Chao       | M      |  23 |

mysql> select stuid ,name,gender,age from students where gender='F';
+-------+---------------+--------+-----+
| stuid | name          | gender | age |
+-------+---------------+--------+-----+
|     7 | Xi Ren        | F      |  19 |
|     8 | Lin Daiyu     | F      |  17 |
|     9 | Ren Yingying  | F      |  20 |         查询这里所有信息都是女的
|    10 | Yue Lingshan  | F      |  19 |
|    12 | Wen Qingqing  | F      |  19 |
|    14 | Lu Wushuang   | F      |  17 |
|    19 | Xue Baochai   | F      |  18 |
|    20 | Diao Chan     | F      |  19 |
|    21 | Huang Yueying | F      |  22 |
|    22 | Xiao Qiao     | F      |  20 |
|    26 | wei           | F      |  21 |
+-------+---------------+--------+-----+


(root@localhost) [hellodb]> select stuid ,name,gender,age from students where name like '%x%';
+-------+-------------+--------+-----+
| stuid | name        | gender | age |
+-------+-------------+--------+-----+
|     3 | Xie Yanke   | M      |  53 |
|     7 | Xi Ren      | F      |  19 |     模糊查询
|    16 | Xu Zhu      | M      |  21 |     x%代表x开头的name模糊查询
|    19 | Xue Baochai | F      |  18 |     %x%  代表有x的模糊查询
|    22 | Xiao Qiao   | F      |  20 |
|    24 | Xu Xian     | M      |  27 |
+-------+-------------+--------+-----+


root@localhost) [hellodb]> select distinct age from students;
+-----+
| age |
+-----+
|  22 |
|  53 |
|  32 |                 distinct   合并去重查询
|  26 |
|  46 |
|  19 |
|  17 |
|  20 |
|  23 |
|  33 |
|  21 |
|  25 |
|  18 |
|  27 |
| 100 |
|  45 |
|  94 |
|  77 |
+-----+

(root@localhost) [hellodb]> select distinct age from students order  by age desc;
+-----+
| age |
+-----+
| 100 |
|  94 |
|  77 |
|  53 |            order  by age;  从小到大排序
|  46 |
|  45 |         order  by age desc   排序从打到小
|  33 |
|  32 |
|  27 |
|  26 |
|  25 |
|  23 |
|  22 |
|  21 |
|  20 |
|  19 |
|  18 |
|  17 |
+-----+
18 rows in set (0.00 sec)

(root@localhost) [hellodb]> select distinct age from students order  by age;
+-----+
| age |
+-----+
|  17 |
|  18 |
|  19 |
|  20 |     order  by age;  从小到大排序
|  22 |
|  23 |
|  25 |
|  26 |
|  27 |
|  32 |
|  33 |
|  45 |
|  46 |
|  53 |
|  77 |
|  94 |
| 100 |
+-----+
18 rows in set (0.00 sec)
、root@localhost) [hellodb]> select gender,avg(age) from students group by gender;
+--------+----------+
| gender | avg(age) |       avg(age)  统计括号里的平均年龄
+--------+----------+       gender 显示年龄大小
| F      |  19.1818 |
| M      |  32.3125 |
+--------+----------+

select gender,max(stuid),avg(age) from students grouproup by gender;
+--------+------------+----------+
| gender | max(stuid) | avg(age) |
+--------+------------+----------+     max(stuid)显示stuid最大值的编号
| M      |         28 |  37.2941 |    
| F      |         29 |  24.0000 |   
+--------+------------+----------+

(root@localhost) [hellodb]> select gender,avg(age) from students group by gender having gender = 'M';
+--------+----------+
| gender | avg(age) |
+--------+----------+      group by gender 分组
| M      |  32.3125 |      having gender = 'M'; 分组后过滤,需要把他加在后面
+--------+----------+

mysql> select gender,avg(age) from students where gender = 'M' group by gender;
+--------+----------+
| gender | avg(age) |        where gender = 'M'  分组前过滤,需要把他加在过滤前面
+--------+----------+        
| M      |  37.2941 |
+--------+----------+




(root@localhost) [hellodb]> select classid,gender,max(age) from students group by classid,gender;
+---------+--------+----------+
| classid | gender | max(age) |
+---------+--------+----------+
|       2 | M      |       53 |
|       1 | M      |       22 |   order by classid 在后面加这个可以对于班级进行排序
|       4 | M      |       32 |   取每个班性别的最大值 
|       3 | M      |       26 |
|       5 | M      |       46 |
|       3 | F      |       19 |     
|       7 | F      |       19 |    
|       6 | F      |       22 |
|       6 | M      |       23 |
|       1 | F      |       21 |
|       7 | M      |       23 |
|    NULL | M      |      100 |
|    NULL | F      |       77 |
+---------+--------+----------+

mysql> select * from students limit 3;
+-------+-------------+-----+--------+---------+-----------+
| StuID | Name        | Age | Gender | ClassID | TeacherID |
+-------+-------------+-----+--------+---------+-----------+
|     1 | Shi Zhongyu |  22 | M      |       2 |         3 |    取前三
|     2 | Shi Potian  |  22 | M      |       1 |         7 |
|     3 | Xie Yanke   |  53 | M      |       2 |        16 |
+-------+-------------+-----+--------+---------+-----------+

select * from students order by age desc limit 3; 
+-------+---------------+-----+--------+---------+-----------+
| StuID | Name          | Age | Gender | ClassID | TeacherID |
+-------+---------------+-----+--------+---------+-----------+
|    25 | Sun Dasheng   | 100 | M      |    NULL |         1 |      排序取前三
|    28 | Zhang Sanfeng |  94 | M      |    NULL |         1 |
|    29 | Miejue Shitai |  77 | F      |    NULL |         1 |
+-------+---------------+-----+--------+---------+-----------+
select * from students order by age desc limit 3,4;
+-------+--------------+-----+--------+---------+-----------+
| StuID | Name         | Age | Gender | ClassID | TeacherID |
+-------+--------------+-----+--------+---------+-----------+
|     3 | Xie Yanke    |  53 | M      |       2 |        16 |
|     6 | Shi Qing     |  46 | M      |       5 |         1 |   跳过前三,显示后4
|    27 | Song Jiang   |  45 | M      |    NULL |         1 |
|    13 | Tian Boguang |  33 | M      |       2 |         1 |
+-------+--------------+-----+--------+---------+-----------+

select * from students where age > (select avg(age) from teachers);
+-------+---------------+-----+--------+---------+-----------+
| StuID | Name          | Age | Gender | ClassID | TeacherID |
+-------+---------------+-----+--------+---------+-----------+
|    25 | Sun Dasheng   | 100 | M      |    NULL |         1 |
|    28 | Zhang Sanfeng |  94 | M      |    NULL |         1 |
+-------+---------------+-----+--------+---------+-----------+
   学生表的年龄比老师平均年龄大的是

select stuid,name,age from students union select tid,name,age from teachers;
+-------+---------------+-----+
| stuid | name          | age |
+-------+---------------+-----+
|     1 | Shi Zhongyu   |  22 |
|     2 | Shi Potian    |  22 |
|     3 | Xie Yanke     |  53 |
|     4 | Ding Dian     |  32 |
|     5 | Yu Yutong     |  26 |
|     6 | Shi Qing      |  46 |
|     7 | Xi Ren        |  19 |
|     8 | Lin Daiyu     |  17 |
|     9 | Ren Yingying  |  20 |
|    10 | Yue Lingshan  |  19 |
|    11 | Yuan Chengzhi |  23 |
|    12 | Wen Qingqing  |  19 |
|    13 | Tian Boguang  |  33 |
|    14 | Lu Wushuang   |  17 |       合并学生表和老师表的指定列
|    15 | Duan Yu       |  19 |
|    16 | Xu Zhu        |  21 |
|    17 | Lin Chong     |  25 |
|    18 | Hua Rong      |  23 |
|    19 | Xue Baochai   |  18 |
|    20 | Diao Chan     |  19 |
|    21 | Huang Yueying |  22 |
|    22 | Xiao Qiao     |  20 |
|    23 | Ma Chao       |  23 |
|    24 | Xu Xian       |  27 |
|    25 | Sun Dasheng   | 100 |
|    26 | wei           |  21 |
|    27 | Song Jiang    |  45 |
|    28 | Zhang Sanfeng |  94 |
|    29 | Miejue Shitai |  77 |
|     1 | Song Jiang    |  45 |
|     2 | Zhang Sanfeng |  94 |
|     3 | Miejue Shitai |  77 |
|     4 | Lin Chaoying  |  93 |
+-------+---------------+-----+


mysql> select * from students where age > (select avg(age) from teachers);
#从名为students的表中选择所有年龄大于teachers表中年龄平均值的记录。
+-------+-------------+-----+--------+---------+-----------+
| StuID | Name        | Age | Gender | ClassID | TeacherID |
+-------+-------------+-----+--------+---------+-----------+
|    25 | Sun Dasheng | 100 | M      |    NULL |      NULL |
+-------+-------------+-----+--------+---------+-----------+
mysql> update students set age=(select avg(age)from teachers) where stuid=25;
Query OK, 1 row affected (0.00 sec)
#将teachers表中age字段的平均值更新到students表中stuid为25的记录的age字段。
mysql> select * from students order by age desc;
+-------+---------------+-----+--------+---------+-----------+
| StuID | Name          | Age | Gender | ClassID | TeacherID |
+-------+---------------+-----+--------+---------+-----------+
|    25 | Sun Dasheng   |  77 | M      |    NULL |      NULL |

联合查询union
交叉连接 cross join
内连接  inner join 
外连接  left outer join  right outer join 

内连接  inner join

inner join 内连接取多个表的交集

mysql> select * from students inner join teachers on students.gender=teachers.gender;
+-------+---------------+-----+--------+---------+-----------+-----+---------------+-----+--------+
| StuID | Name          | Age | Gender | ClassID | TeacherID | TID | Name          | Age | Gender |
+-------+---------------+-----+--------+---------+-----------+-----+---------------+-----+--------+
|     1 | Shi Zhongyu   |  22 | M      |       2 |         3 |   1 | Song Jiang    |  45 | M      |
|     1 | Shi Zhongyu   |  22 | M      |       2 |         3 |   2 | Zhang Sanfeng |  94 | M      |
|     2 | Shi Potian    |  22 | M      |       1 |         7 |   1 | Song Jiang    |  45 | M      |
|     2 | Shi Potian    |  22 | M      |       1 |         7 |   2 | Zhang Sanfeng |  94 | M      |
|     3 | Xie Yanke     |  53 | M      |       2 |        16 |   1 | Song Jiang    |  45 | M      |
|     3 | Xie Yanke     |  53 | M      |       2 |        16 |   2 | Zhang Sanfeng |  94 | M      |
|     4 | Ding Dian     |  32 | M      |       4 |         4 |   1 | Song Jiang    |  45 
联合查询union

联合查询 Union 实现的条件,多个表的字段数量相同,字段名和数据类型可以不同,但一般数据类型是相同的.

mysql> select stuid,name,age from students
    -> union
    -> select tid,name,age from teachers;
#取两个表的tid,name,age 合并在一起  ,这样搞容易错乱
mysql> select stuid,name,age from students union select tid,name,age from teachers;
+-------+---------------+-----+
| stuid | name          | age |
+-------+---------------+-----+
|     1 | Shi Zhongyu   |  22 |
|     2 | Shi Potian    |  22 |
|     3 | Xie Yanke     |  53 |
|     4 | Ding Dian     |  32 |
|     5 | Yu Yutong     |  26 |
|     6 | Shi Qing      |  46 |
|     7 | Xi Ren        |  19 |
|     8 | Lin Daiyu     |  17 |
|     9 | Ren Yingying  |  20 |
|    10 | Yue Lingshan  |  19 |
|    11 | Yuan Chengzhi |  23 |
|    12 | Wen Qingqing  |  19 |
|    13 | Tian Boguang  |  33 |
|    14 | Lu Wushuang   |  17 |
|    15 | Duan Yu       |  19 |
|    16 | Xu Zhu        |  21 |
|    17 | Lin Chong     |  25 |
|    18 | Hua Rong      |  23 |
|    19 | Xue Baochai   |  18 |
|    20 | Diao Chan     |  19 |
|    21 | Huang Yueying |  22 |
|    22 | Xiao Qiao     |  20 |
|    23 | Ma Chao       |  23 |
|    24 | Xu Xian       |  27 |
|    25 | Sun Dasheng   |  77 |
|    26 | wei           |  21 |
|    27 | wsd           |  22 |
|     1 | Song Jiang    |  45 |
|     2 | Zhang Sanfeng |  94 |
|     3 | Miejue Shitai |  77 |
|     4 | Lin Chaoying  |  93 |
+-------+---------------+-----+

select * from students where age > (select avg(age) from teachers);
+-------+---------------+-----+--------+---------+-----------+
| StuID | Name          | Age | Gender | ClassID | TeacherID |
+-------+---------------+-----+--------+---------+-----------+
|    25 | Sun Dasheng   | 100 | M      |    NULL |         1 |
|    28 | Zhang Sanfeng |  94 | M      |    NULL |         1 |
+-------+---------------+-----+--------+---------+-----------+
   学生表的年龄比老师平均年龄大的是

select stuid,name,age from students union select tid,name,age from teachers;
+-------+---------------+-----+
| stuid | name          | age |
+-------+---------------+-----+
|     1 | Shi Zhongyu   |  22 |
|     2 | Shi Potian    |  22 |
|     3 | Xie Yanke     |  53 |
|     4 | Ding Dian     |  32 |
|     5 | Yu Yutong     |  26 |
|     6 | Shi Qing      |  46 |
|     7 | Xi Ren        |  19 |
|     8 | Lin Daiyu     |  17 |
|     9 | Ren Yingying  |  20 |
|    10 | Yue Lingshan  |  19 |
|    11 | Yuan Chengzhi |  23 |
|    12 | Wen Qingqing  |  19 |
|    13 | Tian Boguang  |  33 |
|    14 | Lu Wushuang   |  17 |       合并学生表和老师表的指定列
|    15 | Duan Yu       |  19 |
|    16 | Xu Zhu        |  21 |
|    17 | Lin Chong     |  25 |
|    18 | Hua Rong      |  23 |
|    19 | Xue Baochai   |  18 |
|    20 | Diao Chan     |  19 |
|    21 | Huang Yueying |  22 |
|    22 | Xiao Qiao     |  20 |
|    23 | Ma Chao       |  23 |
|    24 | Xu Xian       |  27 |
|    25 | Sun Dasheng   | 100 |
|    26 | wei           |  21 |
|    27 | Song Jiang    |  45 |
|    28 | Zhang Sanfeng |  94 |
|    29 | Miejue Shitai |  77 |
|     1 | Song Jiang    |  45 |
|     2 | Zhang Sanfeng |  94 |
|     3 | Miejue Shitai |  77 |
|     4 | Lin Chaoying  |  93 |
+-------+---------------+-----+


mysql> select * from students where age > (select avg(age) from teachers);
#从名为students的表中选择所有年龄大于teachers表中年龄平均值的记录。
+-------+-------------+-----+--------+---------+-----------+
| StuID | Name        | Age | Gender | ClassID | TeacherID |
+-------+-------------+-----+--------+---------+-----------+
|    25 | Sun Dasheng | 100 | M      |    NULL |      NULL |
+-------+-------------+-----+--------+---------+-----------+
mysql> update students set age=(select avg(age)from teachers) where stuid=25;
Query OK, 1 row affected (0.00 sec)
#将teachers表中age字段的平均值更新到students表中stuid为25的记录的age字段。
mysql> select * from students order by age desc;
+-------+---------------+-----+--------+---------+-----------+
| StuID | Name          | Age | Gender | ClassID | TeacherID |
+-------+---------------+-----+--------+---------+-----------+
|    25 | Sun Dasheng   |  77 | M      |    NULL |      NULL |
交叉连接等cross join


cross join 即多表的记录之间做笛卡尔乘积组合,并且多个表的列横向合并相加, "雨露均沾"
比如: 第一个表3行4列,第二个表5行6列,cross join后的结果为3*5=15行,4+6=10列
交叉连接生成的记录可能会非常多,建议慎用

union 横行结合 #横向合并,交叉连接(横向笛卡尔)


交叉连接 100和100的数据 是100x100的合成数据 尽量千万别这样做
select * from students inner join teachers on students.gender=teachers.gender;

+-------+---------------+-----+--------+---------+-----------+-----+---------------+-----+--------+
| StuID | Name          | Age | Gender | ClassID | TeacherID | TID | Name          | Age | Gender |
+-------+---------------+-----+--------+---------+-----------+-----+---------------+-----+--------+
|     1 | Shi Zhongyu   |  22 | M      |       2 |         3 |   4 | Lin Chaoying  |  93 | F      |
|     1 | Shi Zhongyu   |  22 | M      |       2 |         3 |   3 | Miejue Shitai |  77 | F      |
|     1 | Shi Zhongyu   |  22 | M      |       2 |         3 |   2 | Zhang Sanfeng |  94 | M      |
|     1 | Shi Zhongyu   |  22 | M      |       2 |         3 |   1 | Song Jiang    |  45 | M      |
|     2 | Shi Potian    |  22 | M      |       1 |         7 |   4 | Lin Chaoying  |  93 | F      |
|     2 | Shi Potian    |  22 | M      |       1 |         7 |   3 | Miejue Shitai |  77 | F      |
|     2 | Shi Potian    |  22 | M      |       1 |         7 |   2 | Zhang Sanfeng |  94 | M      |
|     2 | Shi Potian    |  22 | M      |       1 |         7 |   1 | Song Jiang    |  45 | M      |
|     3 | Xie Yanke     |  53 | M      |       2 |        16 |   4 | Lin Chaoying  |  93 | F      |
|     3 | Xie Yanke     |  53 | M      |       2 |        16 |   3 | Miejue Shitai |  77 | F      |
           ``````````````````````````

#从students表和teachers表中选择所有的列,并且只返回那些在teacherid列和tid列上具有相同值的行。
SELECT 列名
FROM 表1
INNER JOIN 表2
ON 表1.列名 = 表2.列名;

mysql> select *from students inner join teachers on students.teacherid=teachers.tid;
+-------+-------------+-----+--------+---------+-----------+-----+---------------+-----+--------+
| StuID | Name        | Age | Gender | ClassID | TeacherID | TID | Name          | Age | Gender |
+-------+-------------+-----+--------+---------+-----------+-----+---------------+-----+--------+
|     5 | Yu Yutong   |  26 | M      |       3 |         1 |   1 | Song Jiang    |  45 | M      |
|     1 | Shi Zhongyu |  22 | M      |       2 |         3 |   3 | Miejue Shitai |  77 | F      |
|     4 | Ding Dian   |  32 | M      |       4 |         4 |   4 | Lin Chaoying  |  93 | F      |
+-------+-------------+-----+--------+---------+-----------+-----+---------------+-----+-
左外连接left outer join
学生表对应的老师表id
#获取所有学生的信息,并且将他们所属的教师信息也一并获取。如果某个学生没有对应的教师信息,则该学生的教师信息会显示为NULL。
mysql> select * from students left outer join teachers on students.teacherid=teachers.tid;
+-------+---------------+-----+--------+---------+-----------+------+---------------+------+--------+
| StuID | Name          | Age | Gender | ClassID | TeacherID | TID  | Name          | Age  | Gender |
+-------+---------------+-----+--------+---------+-----------+------+---------------+------+--------+
|     5 | Yu Yutong     |  26 | M      |       3 |         1 |    1 | Song Jiang    |   45 | M      |
|     1 | Shi Zhongyu   |  22 | M      |       2 |         3 |    3 | Miejue Shitai |   77 | F      |
|     4 | Ding Dian     |  32 | M      |       4 |         4 |    4 | Lin Chaoying  |   93 | F      |
|     2 | Shi Potian    |  22 | M      |       1 |         7 | NULL | NULL          | NULL | NULL   |
|     3 | Xie Yanke     |  53 | M      |       2 |        16 | NULL | NULL          | NULL | NULL   |
|     6 | Shi Qing      |  46 | M      |       5 |      NULL | NULL | NULL          | NULL
                ···················· 
 右外连接right outer join
  • 获取所有教师的信息,并且将他们所教授的学生信息也一并获取。如果某个教师没有对应的学生信息,则该教师的学生信息会显示为NULL。
mysql> select * from students right outer join teachers on students.teacherid=teachers.tid;
+-------+-------------+------+--------+---------+-----------+-----+---------------+-----+--------+
| StuID | Name        | Age  | Gender | ClassID | TeacherID | TID | Name          | Age | Gender |
+-------+-------------+------+--------+---------+-----------+-----+---------------+-----+--------+
|     1 | Shi Zhongyu |   22 | M      |       2 |         3 |   3 | Miejue Shitai |  77 | F      |
|     4 | Ding Dian   |   32 | M      |       4 |         4 |   4 | Lin Chaoying  |  93 | F      |
|     5 | Yu Yutong   |   26 | M      |       3 |         1 |   1 | Song Jiang    |  45 | M      |
|  NULL | NULL        | NULL | NULL   |    NULL |      NULL |   2 | Zhang Sanfeng |  94 | M      |
+-------+-------------+------+--------+---------+-----------+-----+---------------+-----+--------+
取没有交际的表
mysql> select * from students left outer join teachers on students.teacherid=teachers.tid is null;
+-------+---------------+-----+--------+---------+-----------+------+---------------+------+--------+
| StuID | Name          | Age | Gender | ClassID | TeacherID | TID  | Name          | Age  | Gender |
+-------+---------------+-----+--------+---------+-----------+------+---------------+------+--------+
|     6 | Shi Qing      |  46 | M      |       5 |      NULL |    1 | Song Jiang    |   45 | M      |
|     7 | Xi Ren        |  19 | F      |       3 |      NULL |    1 | Song Jiang    |   45 | M      |
|     8 | Lin Daiyu     |  17 | F      |       7 |      NULL |    1 | Song Jiang    |   45 | M      |
|     9 | Ren Yingying  |  20 | F      |       6 |      NULL |    1 | Song Jiang    |   45 | M      |
|    10 | Yue Lingshan  |  19 | F      |       3 |      NULL |    1 | Song Jiang    |   45 | M      |
|    11 | Yuan Chengzhi |  23 | M      |       6 |      NULL |    1 | Song Jiang    |   45 | M      |
|    12 | Wen Qingqing  |  19 | F      |       1 |      NULL |    1 | Song Jiang    |   45 | M      |
|    13 | Tian Boguang  |  33 | M      |       2 |      NULL |    1 | Song Jiang    |   45 | M      |
完全外连接 

就是左连接加右链接组成的

ysql> select * from students left outer join teachers on students.teacherid=teachers.tid
    -> union
    -> select * from students right join teachers on students.teacherid=teachers.tid
    -> ;
+-------+---------------+------+--------+---------+-----------+------+---------------+------+--------+
| StuID | Name          | Age  | Gender | ClassID | TeacherID | TID  | Name          | Age  | Gender |
+-------+---------------+------+--------+---------+-----------+------+---------------+------+--------+
|     5 | Yu Yutong     |   26 | M      |       3 |         1 |    1 | Song Jiang    |   45 | M      |
|     1 | Shi Zhongyu   |   22 | M      |       2 |         3 |    3 | Miejue Shitai |   77 | F      |
|     4 | Ding Dian     |   32 | M      |       4 |         4 |    4 | Lin Chaoying  |   93 | F      |
|     2 | Shi Potian    |   22 | M      |       1 |         7 | NULL | NULL          | NULL | NULL   |
|     3 | Xie Yanke     |   53 | M      |       2 |        16 | NULL | NULL          | NULL | NULL   |
|     6 | Shi Qing      |   46 | M      |       5 |      NULL | NULL | NULL          | NULL | NULL   |
|     7 | Xi Ren        |   19 | F      |       3 |      NULL | NULL | NULL          | NULL | NULL   |
|     8 | Lin Daiyu     |   17 | F      |       7 |      NULL | NULL | NULL          | NULL | NULL   |
自连接, 即表自身连接自身 

创建

写入

合并 e.leader_id=l.emp_id的对比  一个表格取俩个代号;

mysql> create table emp (emp_id int auto_increment primary key ,name varchar(10),leader_id int);
mysql> insert emp(name,leader_id)value('mage',null),('zhangsir',1),('wang',1),('li',3),('zhao',2);
mysql> select * from emp;
+--------+----------+-----------+
| emp_id | name     | leader_id |
+--------+----------+-----------+
|      1 | mage     |      NULL |
|      2 | zhangsir |         1 |
|      3 | wang     |         1 |
|      4 | li       |         3 |
|      5 | zhao     |         2 |
    ···········
合并
mysql> select * from emp e inner join emp l on e.leader_id=l.emp_id;
+--------+----------+-----------+--------+----------+-----------+
| emp_id | name     | leader_id | emp_id | name     | leader_id |
+--------+----------+-----------+--------+----------+-----------+
|      2 | zhangsir |         1 |      1 | mage     |      NULL |
|      3 | wang     |         1 |      1 | mage     |      NULL |
|      4 | li       |         3 |      3 | wang     |         1 |
|      5 | zhao     |         2 |      2 | zhangsir |         1 |

 null换名(无上级)

mysql> select e.name emp_name, l.name leader_name from emp e left join emp l on e.leader_id=l.emp_id;
+----------+-------------+
| emp_name | leader_name |
+----------+-------------+
| mage     | NULL        |
| zhangsir | mage        |
| wang     | mage        |
| li       | wang        |
| zhao     | zhangsir    |
| mage     | NULL        |
| zhangsir | mage        |
| wang     | mage        |
| li       | wang        |
| zhao     | zhangsir    |
+----------+-------------+
10 rows in set (0.00 sec)

mysql> select e.name emp_name, IFNULL(l.name, '无上级' ) leader_name from emp e left join emp l on e.leader_id=l.emp_id;
+----------+-------------+
| emp_name | leader_name |
+----------+-------------+
| mage     | 无上级      |
| zhangsir | mage        |
| wang     | mage        |
| li       | wang        |
| zhao     | zhangsir    |

三个表内连接查询

mysql> select * from scores;      #分数表                                                                                             
+----+-------+----------+-------+
| ID | StuID | CourseID | Score |
+----+-------+----------+-------+
|  1 |     1 |        2 |    77 |
|  2 |     1 |        6 |    93 |
|  3 |     2 |        2 |    47 |
|  4 |     2 |        5 |    97 |
|  5 |     3 |        2 |    88 |
|  6 |     3 |        6 |    75 |
|  7 |     4 |        5 |    71 |
|  8 |     4 |        2 |    89 |
|  9 |     5 |        1 |    39 |
| 10 |     5 |        7 |    63 |
| 11 |     6 |        1 |    96 |
| 12 |     7 |        1 |    86 |
| 13 |     7 |        7 |    83 |
| 14 |     8 |        4 |    57 |
| 15 |     8 |        3 |    93 |
+----+-------+----------+-------+

mysql> select * from courses;  #课程表
+----------+----------------+
| CourseID | Course         |
+----------+----------------+
|        1 | Hamo Gong      |
|        2 | Kuihua Baodian |
|        3 | Jinshe Jianfa  |
|        4 | Taiji Quan     |
|        5 | Daiyu Zanghua  |
|        6 | Weituo Zhang   |
|        7 | Dagou Bangfa   |
+----------+----------------+

mysql> select * from students;;    学生表
+-------+---------------+-----+--------+---------+-----------+
| StuID | Name          | Age | Gender | ClassID | TeacherID |
+-------+---------------+-----+--------+---------+-----------+
|     1 | Shi Zhongyu   |  22 | M      |       2 |         3 |
|     2 | Shi Potian    |  22 | M      |       1 |         7 |
|     3 | Xie Yanke     |  53 | M      |       2 |        16 |
|     4 | Ding Dian     |  32 | M      |       4 |         4 |
|     5 | Yu Yutong     |  26 | M      |       3 |         1 |
|     6 | Shi Qing      |  46 | M      |       5 |      NULL |
|     7 | Xi Ren        |  19 | F      |       3 |      NULL |
|     8 | Lin Daiyu     |  17 | F      |       7 |      NULL |
|     9 | Ren Yingying  |  20 | F      |       6 |      NULL |
|    10 | Yue Lingshan  |  19 | F      |       3 |      NULL |
|    11 | Yuan Chengzhi |  23 | M      |       6 |      NULL |
|    12 | Wen Qingqing  |  19 | F      |       1 |      NULL |
|    13 | Tian Boguang  |  33 | M      |       2 |      NULL |
|    14 | Lu Wushuang   |  17 | F      |       3 |      NULL |
|    15 | Duan Yu       |  19 | M      |       4 |      NULL |
|    16 | Xu Zhu        |  21 | M      |       1 |      NULL |
|    17 | Lin Chong     |  25 | M      |       4 |      NULL |
|    18 | Hua Rong      |  23 | M      |       7 |      NULL |
|    19 | Xue Baochai   |  18 | F      |       6 |      NULL |
|    20 | Diao Chan     |  19 | F      |       7 |      NULL |
|    21 | Huang Yueying |  22 | F      |       6 |      NULL |
|    22 | Xiao Qiao     |  20 | F      |       1 |      NULL |
|    23 | Ma Chao       |  23 | M      |       4 |      NULL |
|    24 | Xu Xian       |  27 | M      |    NULL |      NULL |
|    25 | Sun Dasheng   |  77 | M      |    NULL |      NULL |
|    26 | wei           |  21 | F      |       1 |      NULL |
|    27 | wsd           |  22 | M      |    NULL |      NULL |
+-------+---------------+-----+--------+---------+-----------+
27 rows in set (0.00 sec)

mysql> select students.name, Course, Score from students inner join scores on students.stuid = scores.stuid inner join courses on scores.CourseID = courses.CourseID;
+-------------+----------------+-------+
| name        | Course         | Score |
+-------------+----------------+-------+
| Shi Zhongyu | Kuihua Baodian |    77 |
| Shi Zhongyu | Weituo Zhang   |    93 |
| Shi Potian  | Kuihua Baodian |    47 |
| Shi Potian  | Daiyu Zanghua  |    97 |
| Xie Yanke   | Kuihua Baodian |    88 |
| Xie Yanke   | Weituo Zhang   |    75 |
| Ding Dian   | Daiyu Zanghua  |    71 |
| Ding Dian   | Kuihua Baodian |    89 |
| Yu Yutong   | Hamo Gong      |    39 |
| Yu Yutong   | Dagou Bangfa   |    63 |
| Shi Qing    | Hamo Gong      |    96 |
| Xi Ren      | Hamo Gong      |    86 |
| Xi Ren      | Dagou Bangfa   |    83 |
| Lin Daiyu   | Taiji Quan     |    57 |
| Lin Daiyu   | Jinshe Jianfa  |    93 |
+-------------+----------------+-------+

FUNCTION 函数

count 统计多少行

 select count(*) from students;

 

mysql> select count(TeacherID ) from students;    #TeacherID的是数值空不算
+-------------------+
| count(TeacherID ) |
+-------------------+
|                 5 |
+-------------------+

 定义别名,执行别名

create view v_students_coures_scores as 定义view v_students_coures_scores为  别名​​​​​​​

mysql> create view v_students_coures_scores as select students.name, Course, Score from students inner join scores on students.stuid = scores.stuid inner join courses on scores.CourseID = courses.CourseID;
Query OK, 0 rows affected (0.01 sec)
mysql> show tables;
+--------------------------+
| Tables_in_hellodb        |
+--------------------------+
| classes                  |
| coc                      |
| courses                  |
| emp                      |
| scores                   |
| students                 |
| teachers                 |
| toc                      |
| v_students_coures_scores |
+--------------------------+

mysql> select * from v_students_coures_scores;
+-------------+----------------+-------+
| name        | Course         | Score |
+-------------+----------------+-------+
| Shi Zhongyu | Kuihua Baodian |    77 |
| Shi Zhongyu | Weituo Zhang   |    93 |
| Shi Potian  | Kuihua Baodian |    47 |
| Shi Potian  | Daiyu Zanghua  |    97 |
| Xie Yanke   | Kuihua Baodian |    88 |
| Xie Yanke   | Weituo Zhang   |    75 |
| Ding Dian   | Daiyu Zanghua  |    71 |
| Ding Dian   | Kuihua Baodian |    89 |
| Yu Yutong   | Hamo Gong      |    39 |
| Yu Yutong   | Dagou Bangfa   |    63 |
| Shi Qing    | Hamo Gong      |    96 |
| Xi Ren      | Hamo Gong      |    86 |
| Xi Ren      | Dagou Bangfa   |    83 |
| Lin Daiyu   | Taiji Quan     |    57 |
| Lin Daiyu   | Jinshe Jianfa  |    93 |
+-------------+----------------+-------+

VIEW视图查看 

mysql> show table status like 'v_students_coures_scores'\G;
*************************** 1. row ***************************
           Name: v_students_coures_scores
         Engine: NULL
        Version: NULL
     Row_format: NULL
           Rows: NULL
 Avg_row_length: NULL
    Data_length: NULL
Max_data_length: NULL
   Index_length: NULL
      Data_free: NULL
 Auto_increment: NULL
    Create_time: NULL
    Update_time: NULL
     Check_time: NULL
      Collation: NULL
       Checksum: NULL
 Create_options: NULL
        Comment: VIEW
1 row in set (0.00 sec)

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:/a/184748.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

猿人学(非常简单三道题)

17. 天杀的http2.0 https://blog.csdn.net/weixin_44327634/article/details/123740008?ops_request_misc%257B%2522request%255Fid%2522%253A%2522169949361816800180633940%2522%252C%2522scm%2522%253A%252220140713.130102334..%2522%257D&request_id169949361816800…

一个悄然崛起的国产软件!!AI 又进化了!!

大家好&#xff0c;我是 Jack。 AI 写代码想必很多人都体验过了&#xff0c;使用 AI 编程工具是一个大趋势&#xff0c;越早学会使用 AI 辅助你写代码&#xff0c;你的效率也会越高。 甚至有些公司已经要求员工具备 AI 编程能力。 对于学生党&#xff0c;AI 编程可以帮助我们…

【23真题】最简单的211!均分141分!

今天分享的是23年河海大学863的信号与系统试题及解析。 我猜测是由于23年太简单&#xff0c;均分都141分&#xff0c;导致24考研临时新增一门数字信号处理&#xff01;今年考研的同学赶不上这么简单的专业课啦&#xff01; 本套试卷难度分析&#xff1a;平均分为102和141分&a…

进制转换 蓝桥oj Alice和Bob的爱恨情仇

题目 翻译 主要思路 举个例子方便理解 以奇数为底去分解一个奇数&#xff0c;分解次数一定是奇数&#xff1b;以奇数为底去分解一个偶数&#xff0c;分解次数一定是偶数 如果一个堆的分解次数是奇数&#xff0c;就在总分解次数上加1&#xff1b;如果一个堆的分解次数是偶数&…

关于 Google AMP 和 SEO

Google 于 2015 年首次推出 AMP&#xff0c;即加速移动页面。借助开源 AMP 框架&#xff0c;网页设计师可以制作快速加载的移动网页。该框架的创建是为了应对使用移动设备访问互联网的个人数量的增加。从那时起&#xff0c;谷歌一直在推动使用 AMP 来增强移动设备上的 SEO 和用…

phpstudy和IDEA 配置php debug

1.安装xdebug 扩展&#xff0c;phpinfo() 查看 2.配置php.ini zend_extensionD:/phpstudy_pro/Extensions/php/php7.4.3nts/ext/php_xdebug.dll xdebug.collect_params1 xdebug.collect_return1 xdebug.auto_traceOn xdebug.trace_output_dirD:/phpstudy_pro/Extensions/php_l…

解决DaemonSet没法调度到master节点的问题

最近在kubernetes部署一个springcloud微服务项目&#xff0c;到了最后一步部署边缘路由&#xff1a;使用nginx-ingress和traefik都可以&#xff0c;必须使用DaemonSet部署&#xff0c;但是发现三个节点&#xff0c;却总共只有两个pod。 换句话说&#xff0c; DaemonSet没法调度…

30㎡新中式大横厅|方寸之间,诉说东方写意生活。福州中宅装饰,福州装修

今天要分享的是一个新中式风格的客厅装修&#xff0c;它的开间是4.5米&#xff0c;进深是6.5米。设计中有许多亮点&#xff0c;让我们一起来看看。 1️⃣ 首先&#xff0c;这个客厅采用了双眼皮无主灯吊顶的设计&#xff0c;让整个空间看起来更加高挑宽敞。吊顶的边缘线条简洁明…

Unity UGUI图片锯齿严重怎么解决

在开发的时候&#xff0c;发现图片锯齿严重&#xff0c;打包到移动端或者在编辑器都这样&#xff0c;如下图 原因&#xff1a; 查了一些资料&#xff0c;找到了原因如下&#xff1a;关于为什么会发生这种情况&#xff1a;看起来你的源资源比你在屏幕上显示的大小大得多。所以当…

Android设计模式--适配器模式

至诚之道&#xff0c;可以前知 一&#xff0c;定义 适配器模式把一个类的接口变换成客户端所期待的另一种接口&#xff0c;从而使原本因接口不匹配而无法在一起工作的两个类能够在一起工作。 适配器模式在我们的开发中使用率极高&#xff0c;ListView&#xff0c;GridView&am…

unity Toggle,初始时默认不选中,若选中则不可取消选中。不写码实现其效果

实现效果&#xff1a; 初始默认时&#xff1a; 选中时&#xff1a; 零代码实现&#xff1a; 步骤1 步骤2 步骤3

日常生活小技巧 -- Win10 系统安装 Linux 子系统

最新要在win10系统安装linux子系统&#xff0c;看一下教程。 参看&#xff1a;Win10 系统安装 Linux 子系统教程(WSL2 Ubuntu 20.04 Gnome 桌面 &#xff09; 1、开启开发人员模式 2、适用于linux的Windows子系统 勾选下图三个选项&#xff0c;重启。 3、安装 Ubuntu 创建…

Leetcode199. 二叉树的右视图

Every day a Leetcode 题目来源&#xff1a;199. 二叉树的右视图 解法1&#xff1a;层序遍历 给定一个二叉树的 根节点 root&#xff0c;想象自己站在它的右侧&#xff0c;按照从顶部到底部的顺序&#xff0c;返回从右侧所能看到的节点值。 按层序遍历&#xff0c;将每层的…

『接口测试干货』| Newman+Postman接口自动化测试完整过程

『接口测试干货』| NewmanPostman接口自动化测试完整过程 1 Newman简介2 如何安装Newman&#xff1f;2.1 安装NodeJs2.2 安装Newman2.2 解决Newman不是内部命令 3 Newman使用3.1 Newman如何运行集合&#xff1f;3.2 如何查看帮助文档&#xff1f;3.3 环境变量设置3.4 关于全局变…

Win10系统Steam错误代码118的解决教程

在Win10系统中&#xff0c;用户可以打开Steam平台搜索喜欢的游戏&#xff0c;点击开始畅玩。但是&#xff0c;有用户反映自己在Steam平台上操作的时候&#xff0c;收到了错误代码118的提示&#xff0c;导致自己没有办法正常进行操作。接下来小编给大家详细介绍关于解决Win10系统…

MariaDB(基础信息)

文章目录 一、MariaDB1、基本信息2、存储引擎3、兼容性》MySQL、Postgres、MongoDB 和 Oracle4、直接连接其他数据源5、等等等。。。。。。。。。。。。。。。。。。。。。 二、操作和mysql一样参考文章 --------------------机翻内容仅供参考------------------------- 一、…

linux基础5:linux进程1(冯诺依曼体系结构+os管理+进程状态1)

冯诺依曼体系结构os管理 一.冯诺依曼体系结构&#xff1a;1.简单介绍&#xff08;准备一&#xff09;2.场景&#xff1a;1.程序的运行&#xff1a;2.登录qq发送消息&#xff1a; 3.为什么需要内存&#xff1a;1.简单的引入&#xff1a;2.计算机存储体系&#xff1a;3.内存的意义…

【广州华锐互动】利用VR体验环保低碳生活能带来哪些教育意义?

随着科技的不断发展&#xff0c;虚拟现实&#xff08;VR&#xff09;技术已经逐渐走进了我们的生活。从游戏娱乐到教育培训&#xff0c;VR技术的应用范围越来越广泛。而在这个追求绿色、环保的时代&#xff0c;VR技术也为我们带来了一种全新的环保低碳生活方式。让我们一起走进…

企业微信web登录实现

企业微信登录流程 实现方式 使用js-sdk 使用 wecom/jssdk 初始化企业微信登录组件。 为了满足网站定制化的需求&#xff0c;我们支持将企业微信登录组件内嵌到开发者的网站中。用户使用企业微信登录授权后&#xff0c;登录组件将 auth code 返回给网站。 企业微信登录组件主…

Android开发从0开始(广播)

应用广播 发送标准广播的三步骤 发送标准广播&#xff1a; //发送标准广播 Intent intent new Intent("com.dongnaoedu.chapter09.standard"); sendBroadcast(intent); 定义广播接受者: public class StanderdReceiver extends BroadcastReceiver { public s…