no message

This commit is contained in:
YoVinchen 2023-08-31 12:43:36 +08:00
parent 1b3c5235fe
commit 2713400ef0
47 changed files with 393 additions and 393 deletions

View File

@ -48,7 +48,7 @@
"state": { "state": {
"type": "search", "type": "search",
"state": { "state": {
"query": "复制", "query": "https://lsky.hhdxw.top/imghub/img
"matchingCase": false, "matchingCase": false,
"explainSearch": false, "explainSearch": false,
"collapseAll": false, "collapseAll": false,

View File

@ -40,7 +40,7 @@ smartctl -a /dev/disk0
其中,`-a` 选项用于显示所有可用的 SMART 信息,`/dev/disk0` 表示要检测的硬盘设备文件。 其中,`-a` 选项用于显示所有可用的 SMART 信息,`/dev/disk0` 表示要检测的硬盘设备文件。
![c87f114b790cfba15db88f5e1d1d9e96](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/c87f114b790cfba15db88f5e1d1d9e96.png) ![c87f114b790cfba15db88f5e1d1d9e96](https://lsky.hhdxw.top/imghub/img/c87f114b790cfba15db88f5e1d1d9e96.png)
结果如下里面的Percentage Used 就是损耗值Data Units Written 就是写入量。 结果如下里面的Percentage Used 就是损耗值Data Units Written 就是写入量。

View File

@ -12,7 +12,7 @@
![image-20220301163353065](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220301163353065.png) ![image-20220301163353065](https://lsky.hhdxw.top/imghub/img/image-20220301163353065.png)
@ -24,7 +24,7 @@
![image-20220301163856266](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220301163856266.png) ![image-20220301163856266](https://lsky.hhdxw.top/imghub/img/image-20220301163856266.png)
@ -42,7 +42,7 @@
![image-20220301164904720](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220301164904720.png) ![image-20220301164904720](https://lsky.hhdxw.top/imghub/img/image-20220301164904720.png)
@ -59,7 +59,7 @@
![image-20220302110623820](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220302110623820.png) ![image-20220302110623820](https://lsky.hhdxw.top/imghub/img/image-20220302110623820.png)
@ -67,7 +67,7 @@
![image-20220301170612258](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220301170612258.png) ![image-20220301170612258](https://lsky.hhdxw.top/imghub/img/image-20220301170612258.png)
@ -75,7 +75,7 @@
![image-20220301171039307](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220301171039307.png) ![image-20220301171039307](https://lsky.hhdxw.top/imghub/img/image-20220301171039307.png)
@ -83,7 +83,7 @@
![image-20220302110722790](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220302110722790.png) ![image-20220302110722790](https://lsky.hhdxw.top/imghub/img/image-20220302110722790.png)
@ -91,7 +91,7 @@
![image-20220301171713956](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220301171713956.png) ![image-20220301171713956](https://lsky.hhdxw.top/imghub/img/image-20220301171713956.png)
@ -99,7 +99,7 @@
![image-20220301172210713](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220301172210713.png) ![image-20220301172210713](https://lsky.hhdxw.top/imghub/img/image-20220301172210713.png)
### 二、Spring的体系结构 ### 二、Spring的体系结构
@ -160,7 +160,7 @@ Dao层——和数据库打交道
![image-20220301180826354](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220301180826354.png) ![image-20220301180826354](https://lsky.hhdxw.top/imghub/img/image-20220301180826354.png)
@ -168,7 +168,7 @@ Dao层——和数据库打交道
![image-20220301223812386](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220301223812386.png) ![image-20220301223812386](https://lsky.hhdxw.top/imghub/img/image-20220301223812386.png)
@ -176,7 +176,7 @@ Dao层——和数据库打交道
![image-20220301223743212](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220301223743212.png) ![image-20220301223743212](https://lsky.hhdxw.top/imghub/img/image-20220301223743212.png)
4.在 Java 源包下创建名为 UserDao 接口、名为 UserDaoImpl 的 Java 以及Test测试类 4.在 Java 源包下创建名为 UserDao 接口、名为 UserDaoImpl 的 Java 以及Test测试类
@ -219,7 +219,7 @@ public class test {
![image-20220301225430222](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220301225430222.png) ![image-20220301225430222](https://lsky.hhdxw.top/imghub/img/image-20220301225430222.png)
代码如下: 代码如下:
@ -233,7 +233,7 @@ public class test {
完成导包后如图: 完成导包后如图:
![image-20220301230136985](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220301230136985.png) ![image-20220301230136985](https://lsky.hhdxw.top/imghub/img/image-20220301230136985.png)
@ -243,7 +243,7 @@ public class test {
![image-20220301230431966](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220301230431966.png) ![image-20220301230431966](https://lsky.hhdxw.top/imghub/img/image-20220301230431966.png)
@ -255,7 +255,7 @@ public class test {
![image-20220302102447695](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220302102447695.png) ![image-20220302102447695](https://lsky.hhdxw.top/imghub/img/image-20220302102447695.png)
@ -277,7 +277,7 @@ ApplicationContext applicationContext = new ClassPathXmlApplicationContext("appl
![image-20220302104836410](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220302104836410.png) ![image-20220302104836410](https://lsky.hhdxw.top/imghub/img/image-20220302104836410.png)

View File

@ -68,7 +68,7 @@ public class TsetDI {
} }
``` ```
![image-20220303222001817](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220303222001817.png) ![image-20220303222001817](https://lsky.hhdxw.top/imghub/img/image-20220303222001817.png)
## 1.IOC控制反转类对象的创建由程序员转给了Spring框架 ## 1.IOC控制反转类对象的创建由程序员转给了Spring框架

View File

@ -61,7 +61,7 @@ public static void main(String[] args) {
程序执行截图: 程序执行截图:
![image-20220309123304518](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220309123304518.png) ![image-20220309123304518](https://lsky.hhdxw.top/imghub/img/image-20220309123304518.png)
## 3、静态工厂实例化 ## 3、静态工厂实例化
@ -96,7 +96,7 @@ public static void main(String[] args) {
程序执行截图: 程序执行截图:
![image-20220309142136727](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220309142136727.png) ![image-20220309142136727](https://lsky.hhdxw.top/imghub/img/image-20220309142136727.png)
## 4、实例工厂实例化 ## 4、实例工厂实例化
@ -141,4 +141,4 @@ public static void main(String[] args) {
程序执行截图: 程序执行截图:
![image-20220309144326438](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220309144326438.png) ![image-20220309144326438](https://lsky.hhdxw.top/imghub/img/image-20220309144326438.png)

View File

@ -106,7 +106,7 @@ private String username;
运行结果如图: 运行结果如图:
![image-20220310180658138](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220310180658138.png) ![image-20220310180658138](https://lsky.hhdxw.top/imghub/img/image-20220310180658138.png)
### 总结基于XML的装配使用方式 ### 总结基于XML的装配使用方式
@ -285,7 +285,7 @@ public class Test {
装配成功运行结果如截图如下: 装配成功运行结果如截图如下:
![image-20220311125821133](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220311125821133.png) ![image-20220311125821133](https://lsky.hhdxw.top/imghub/img/image-20220311125821133.png)
### 3.自动装配 ### 3.自动装配

View File

@ -56,7 +56,7 @@ public class Test {
运行截图: 运行截图:
![image-20220323125142944](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220323125142944.png) ![image-20220323125142944](https://lsky.hhdxw.top/imghub/img/image-20220323125142944.png)
## AOP术语 ## AOP术语
@ -172,7 +172,7 @@ public class JdkTest {
运行截图: 运行截图:
![image-20220323150132535](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220323150132535.png) ![image-20220323150132535](https://lsky.hhdxw.top/imghub/img/image-20220323150132535.png)
@ -263,7 +263,7 @@ public class cglibTest {
运行截图如下: 运行截图如下:
![image-20220324113512719](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220324113512719.png) ![image-20220324113512719](https://lsky.hhdxw.top/imghub/img/image-20220324113512719.png)
JDK代理和CGLIB代理方式的缺点 JDK代理和CGLIB代理方式的缺点

View File

@ -170,7 +170,7 @@ public class AopTest {
代码实现截图: 代码实现截图:
![image-20220324140614514](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220324140614514.png) ![image-20220324140614514](https://lsky.hhdxw.top/imghub/img/image-20220324140614514.png)
@ -208,7 +208,7 @@ public class ExceptionTest {
} }
``` ```
![image-20220324142225871](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220324142225871.png) ![image-20220324142225871](https://lsky.hhdxw.top/imghub/img/image-20220324142225871.png)
#### 2空指针异常 #### 2空指针异常
@ -228,7 +228,7 @@ public class ExceptionTest2 {
} }
``` ```
![image-20220324143554018](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220324143554018.png) ![image-20220324143554018](https://lsky.hhdxw.top/imghub/img/image-20220324143554018.png)
### 2.处理异常 ### 2.处理异常

View File

@ -180,11 +180,11 @@ public class XmlTest {
正常运行结果: 正常运行结果:
![image-20220328214914512](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220328214914512.png) ![image-20220328214914512](https://lsky.hhdxw.top/imghub/img/image-20220328214914512.png)
运行发生异常截图:出现结果为零异常 运行发生异常截图:出现结果为零异常
![image-20220328214954611](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220328214954611.png) ![image-20220328214954611](https://lsky.hhdxw.top/imghub/img/image-20220328214954611.png)
### 二、基于注解Annotation-------减少xml中的代码量 ### 二、基于注解Annotation-------减少xml中的代码量
@ -325,4 +325,4 @@ public class AnnotationTest {
运行截图: 运行截图:
![image-20220328215304530](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220328215304530.png) ![image-20220328215304530](https://lsky.hhdxw.top/imghub/img/image-20220328215304530.png)

View File

@ -81,7 +81,7 @@ public class JdbcTest {
运行结果如下数据库中已经成功创建表account 运行结果如下数据库中已经成功创建表account
![image-20220329195454770](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220329195454770.png) ![image-20220329195454770](https://lsky.hhdxw.top/imghub/img/image-20220329195454770.png)
## 二、update():增删改 ## 二、update():增删改
@ -277,15 +277,15 @@ public class JdbcTest {
1.创建两个数据 1.创建两个数据
![image-20220331221520933](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220331221520933.png) ![image-20220331221520933](https://lsky.hhdxw.top/imghub/img/image-20220331221520933.png)
2.测试删除数据 2.测试删除数据
![image-20220331221604934](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220331221604934.png) ![image-20220331221604934](https://lsky.hhdxw.top/imghub/img/image-20220331221604934.png)
3.更新数据 3.更新数据
![image-20220331221704292](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220331221704292.png) ![image-20220331221704292](https://lsky.hhdxw.top/imghub/img/image-20220331221704292.png)
### 补充: ### 补充:
@ -392,9 +392,9 @@ public void findAllAccoundsTest() {
1.单个查询 1.单个查询
![image-20220331223326855](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220331223326855.png) ![image-20220331223326855](https://lsky.hhdxw.top/imghub/img/image-20220331223326855.png)
2.多项查询 2.多项查询
![image-20220331223422159](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220331223422159.png) ![image-20220331223422159](https://lsky.hhdxw.top/imghub/img/image-20220331223422159.png)

View File

@ -92,11 +92,11 @@ public void transferTest() {
1.无异常 1.无异常
![image-20220331225557619](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220331225557619.png) ![image-20220331225557619](https://lsky.hhdxw.top/imghub/img/image-20220331225557619.png)
2.有异常 2.有异常
![image-20220331225618374](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220331225618374.png) ![image-20220331225618374](https://lsky.hhdxw.top/imghub/img/image-20220331225618374.png)
## 二、基于Annotation注解方式的声明式事务 ## 二、基于Annotation注解方式的声明式事务
@ -137,9 +137,9 @@ public void transferTest() {
1.无异常: 1.无异常:
![image-20220331225721435](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220331225721435.png) ![image-20220331225721435](https://lsky.hhdxw.top/imghub/img/image-20220331225721435.png)
2.有异常: 2.有异常:
![image-20220331225754769](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220331225754769.png) ![image-20220331225754769](https://lsky.hhdxw.top/imghub/img/image-20220331225754769.png)

View File

@ -57,7 +57,7 @@ insert into t_customer values
('3','tom','worker','15179405961'); ('3','tom','worker','15179405961');
``` ```
![image-20220405130626049](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220405130626049.png) ![image-20220405130626049](https://lsky.hhdxw.top/imghub/img/image-20220405130626049.png)
#### 2创建项目导2个包mybatis mysql-connector-java #### 2创建项目导2个包mybatis mysql-connector-java
@ -153,13 +153,13 @@ public class Customer {
</mapper> </mapper>
``` ```
![image-20220405131535640](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220405131535640.png) ![image-20220405131535640](https://lsky.hhdxw.top/imghub/img/image-20220405131535640.png)
##### 2.创建CustomerMapper.xml文件 ##### 2.创建CustomerMapper.xml文件
在 resources 文件夹右击选择 new新建Mapper 在 resources 文件夹右击选择 new新建Mapper
![image-20220405132203804](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220405132203804.png) ![image-20220405132203804](https://lsky.hhdxw.top/imghub/img/image-20220405132203804.png)
##### 3.写sql语句 ##### 3.写sql语句
@ -177,7 +177,7 @@ public class Customer {
</select> </select>
``` ```
![image-20220405132451651](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220405132451651.png) ![image-20220405132451651](https://lsky.hhdxw.top/imghub/img/image-20220405132451651.png)
#### 5在resources文件夹下创建mybatis-config.xml文件该文件是MyBatis框架的配置文件 #### 5在resources文件夹下创建mybatis-config.xml文件该文件是MyBatis框架的配置文件
@ -194,13 +194,13 @@ public class Customer {
</configuration> </configuration>
``` ```
![image-20220405131954150](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220405131954150.png) ![image-20220405131954150](https://lsky.hhdxw.top/imghub/img/image-20220405131954150.png)
##### 2.创建mybatis-config.xml文件 ##### 2.创建mybatis-config.xml文件
在 resources 文件夹右击选择 new新建mybatis-config 在 resources 文件夹右击选择 new新建mybatis-config
![image-20220405132528897](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220405132528897.png) ![image-20220405132528897](https://lsky.hhdxw.top/imghub/img/image-20220405132528897.png)
##### 3.配置MyBatis框架 ##### 3.配置MyBatis框架
@ -228,7 +228,7 @@ public class Customer {
</configuration> </configuration>
``` ```
![image-20220405132915669](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220405132915669.png) ![image-20220405132915669](https://lsky.hhdxw.top/imghub/img/image-20220405132915669.png)
#### 6单元测试查询 #### 6单元测试查询
@ -238,11 +238,11 @@ public class Customer {
通过 CustomerMapper.xml 文件中的 select 的 id 的值来命名测试类 通过 CustomerMapper.xml 文件中的 select 的 id 的值来命名测试类
![image-20220405133745512](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220405133745512.png) ![image-20220405133745512](https://lsky.hhdxw.top/imghub/img/image-20220405133745512.png)
在输入 **Resources** 时通过提示导入名为 org 开头的包 在输入 **Resources** 时通过提示导入名为 org 开头的包
![image-20220405134057509](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220405134057509.png) ![image-20220405134057509](https://lsky.hhdxw.top/imghub/img/image-20220405134057509.png)
在此输入完此行代码后 getResourceAsStream 会爆红,不用管后续处理 在此输入完此行代码后 getResourceAsStream 会爆红,不用管后续处理
@ -264,13 +264,13 @@ SqlSession sqlSession = sqlSessionFactory.openSession();
因为要测试多个方法,所以将以上构造剪切到**成员变量** 因为要测试多个方法,所以将以上构造剪切到**成员变量**
![image-20220405134848712](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220405134848712.png) ![image-20220405134848712](https://lsky.hhdxw.top/imghub/img/image-20220405134848712.png)
##### 4.处理爆红错误 ##### 4.处理爆红错误
将鼠标放置到爆红的 resourceAsStream 处 Alt+回车 处理问题,选择添加类默认构造函数签名的异常 将鼠标放置到爆红的 resourceAsStream 处 Alt+回车 处理问题,选择添加类默认构造函数签名的异常
![image-20220405134938312](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220405134938312.png) ![image-20220405134938312](https://lsky.hhdxw.top/imghub/img/image-20220405134938312.png)
##### 5.导包 Test ,并写完查询类 ##### 5.导包 Test ,并写完查询类
@ -309,7 +309,7 @@ public class MybatisTest {
运行结果如下: 运行结果如下:
![image-20220405135447683](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220405135447683.png) ![image-20220405135447683](https://lsky.hhdxw.top/imghub/img/image-20220405135447683.png)
### 1.根据id查询客户 ### 1.根据id查询客户
@ -327,7 +327,7 @@ public void findCustomerById() {
} }
``` ```
![image-20220407152029547](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220407152029547.png) ![image-20220407152029547](https://lsky.hhdxw.top/imghub/img/image-20220407152029547.png)
### 2.根据姓名模糊查询 ### 2.根据姓名模糊查询
@ -347,7 +347,7 @@ public void findCustomerByName() {
} }
``` ```
![image-20220407152044583](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220407152044583.png) ![image-20220407152044583](https://lsky.hhdxw.top/imghub/img/image-20220407152044583.png)
### 3.添加客户 ### 3.添加客户
@ -371,7 +371,7 @@ public void addCustomer(){
} }
``` ```
![image-20220407152231144](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220407152231144.png) ![image-20220407152231144](https://lsky.hhdxw.top/imghub/img/image-20220407152231144.png)
### 4.更新客户 ### 4.更新客户
@ -395,7 +395,7 @@ public void updateCustomer() {
} }
``` ```
![image-20220407152334704](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220407152334704.png) ![image-20220407152334704](https://lsky.hhdxw.top/imghub/img/image-20220407152334704.png)
### 5.删除客户 ### 5.删除客户
@ -414,7 +414,7 @@ public void deleteCustomer() {
} }
``` ```
![image-20220407152346163](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220407152346163.png) ![image-20220407152346163](https://lsky.hhdxw.top/imghub/img/image-20220407152346163.png)
@ -436,20 +436,20 @@ public void deleteCustomer() {
(4) 将CustomerMapper.xml文件复制到com下 (4) 将CustomerMapper.xml文件复制到com下
![image-20220407152650898](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220407152650898.png) ![image-20220407152650898](https://lsky.hhdxw.top/imghub/img/image-20220407152650898.png)
(5) 复制后的CustomerMapper.Xml中的namespacel的值修改com.CustomerMapper (5) 复制后的CustomerMapper.Xml中的namespacel的值修改com.CustomerMapper
![image-20220407152719404](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220407152719404.png) ![image-20220407152719404](https://lsky.hhdxw.top/imghub/img/image-20220407152719404.png)
(6) 修改mybatis-config.xml文件中resource属性的值 (6) 修改mybatis-config.xml文件中resource属性的值
![image-20220407152735127](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220407152735127.png) ![image-20220407152735127](https://lsky.hhdxw.top/imghub/img/image-20220407152735127.png)
(7) 修改测试方法中的值: (7) 修改测试方法中的值:
![image-20220407152802930](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220407152802930.png) ![image-20220407152802930](https://lsky.hhdxw.top/imghub/img/image-20220407152802930.png)
运行测试结果如下: 运行测试结果如下:
![image-20220407152822914](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220407152822914.png) ![image-20220407152822914](https://lsky.hhdxw.top/imghub/img/image-20220407152822914.png)

View File

@ -191,7 +191,7 @@ public class MybatisTest {
运行结果如下: 运行结果如下:
![image-20220412211705869](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220412211705869.png) ![image-20220412211705869](https://lsky.hhdxw.top/imghub/img/image-20220412211705869.png)
### 2.创建工具类对外提供SqlSession对象 ### 2.创建工具类对外提供SqlSession对象
@ -231,7 +231,7 @@ public class MyBatisTest {
运行截图: 运行截图:
![image-20220412213246062](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220412213246062.png) ![image-20220412213246062](https://lsky.hhdxw.top/imghub/img/image-20220412213246062.png)
@ -269,7 +269,7 @@ jdbc.password=8520
3测试运行截图 3测试运行截图
![image-20220413084844679](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220413084844679.png) ![image-20220413084844679](https://lsky.hhdxw.top/imghub/img/image-20220413084844679.png)
### 2.typeAliases元素 给实体类起别名 ### 2.typeAliases元素 给实体类起别名
@ -292,7 +292,7 @@ jdbc.password=8520
3测试截图如下 3测试截图如下
![image-20220413090235983](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220413090235983.png) ![image-20220413090235983](https://lsky.hhdxw.top/imghub/img/image-20220413090235983.png)
## 7.3 映射文件 ## 7.3 映射文件
@ -306,7 +306,7 @@ jdbc.password=8520
Customer{id=2, name='null', jobs='teacher', phone='13521210112'} Customer{id=2, name='null', jobs='teacher', phone='13521210112'}
![image-20220413091252095](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220413091252095.png) ![image-20220413091252095](https://lsky.hhdxw.top/imghub/img/image-20220413091252095.png)
3如何解决当实体类中的成员变量名和表中字段名字不一致时还可以将字段值赋值给成员变量 3如何解决当实体类中的成员变量名和表中字段名字不一致时还可以将字段值赋值给成员变量
@ -358,7 +358,7 @@ log4j.appender.stdout.layout.ConversionPattern=%5p [%t]-%m%n
3resources 下 创建com,把CustomerMapper.xml文件移动到com下 3resources 下 创建com,把CustomerMapper.xml文件移动到com下
![image-20220413093052137](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220413093052137.png) ![image-20220413093052137](https://lsky.hhdxw.top/imghub/img/image-20220413093052137.png)
4修改两个xml文件 4修改两个xml文件
@ -382,4 +382,4 @@ Customer o = sqlSession.selectOne("com.CustomerMapper.findCustomerById", 2);
6运行截图 6运行截图
![image-20220413092737690](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220413092737690.png) ![image-20220413092737690](https://lsky.hhdxw.top/imghub/img/image-20220413092737690.png)

View File

@ -74,11 +74,11 @@ public void findCustomerByNameAndJobsTest(){
传一个名字,按名字查询: 传一个名字,按名字查询:
![image-20220415134517801](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220415134517801.png) ![image-20220415134517801](https://lsky.hhdxw.top/imghub/img/image-20220415134517801.png)
不传参查询全部: 不传参查询全部:
![image-20220415134721203](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220415134721203.png) ![image-20220415134721203](https://lsky.hhdxw.top/imghub/img/image-20220415134721203.png)
### 2. choose - when - otherwise 元素 ### 2. choose - when - otherwise 元素
@ -134,11 +134,11 @@ public void findCustomerByNameOrJobs(){
传职业,按职业查询: 传职业,按职业查询:
![image-20220415134806665](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220415134806665.png) ![image-20220415134806665](https://lsky.hhdxw.top/imghub/img/image-20220415134806665.png)
不传参,查询有手机号: 不传参,查询有手机号:
![image-20220415134848949](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220415134848949.png) ![image-20220415134848949](https://lsky.hhdxw.top/imghub/img/image-20220415134848949.png)
### 3. where 元素 ### 3. where 元素
@ -183,11 +183,11 @@ public void findCustomerByNameAndJobs1Test(){
传一个名字,按名字查询: 传一个名字,按名字查询:
![image-20220415135501209](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220415135501209.png) ![image-20220415135501209](https://lsky.hhdxw.top/imghub/img/image-20220415135501209.png)
不传参查询全部: 不传参查询全部:
![image-20220415135537915](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220415135537915.png) ![image-20220415135537915](https://lsky.hhdxw.top/imghub/img/image-20220415135537915.png)
### 4. set 元素 ### 4. set 元素
@ -230,4 +230,4 @@ public void updateCustomer(){
运行截图: 运行截图:
![image-20220415135735652](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220415135735652.png) ![image-20220415135735652](https://lsky.hhdxw.top/imghub/img/image-20220415135735652.png)

View File

@ -48,7 +48,7 @@ insert into tb_person(name,age,sex,card_id) values
('Tom',20,'男',2); ('Tom',20,'男',2);
``` ```
![image-20220419102233809](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220419102233809.png) ![image-20220419102233809](https://lsky.hhdxw.top/imghub/img/image-20220419102233809.png)
#### 2.创建项目导入依赖mybatis mysql #### 2.创建项目导入依赖mybatis mysql
@ -176,7 +176,7 @@ public class MyBatisTest {
运行截图: 运行截图:
![image-20220419112333746](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220419112333746.png) ![image-20220419112333746](https://lsky.hhdxw.top/imghub/img/image-20220419112333746.png)
### 二、使用嵌套结果根据id查询客户的所有信息(id,name,age,sex,Car_id,code) ### 二、使用嵌套结果根据id查询客户的所有信息(id,name,age,sex,Car_id,code)
@ -221,7 +221,7 @@ public class MyBatisTest {
} }
``` ```
![image-20220419120201332](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220419120201332.png) ![image-20220419120201332](https://lsky.hhdxw.top/imghub/img/image-20220419120201332.png)

View File

@ -57,7 +57,7 @@ mybatis mybatis-spring spring mysql spring-tx spring-jdbc commons-dbcp2
mybatis 中的 t_customer mybatis 中的 t_customer
![image-20220426132557267](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220426132557267.png) ![image-20220426132557267](https://lsky.hhdxw.top/imghub/img/image-20220426132557267.png)
#### 2.创建实体类 #### 2.创建实体类
@ -143,7 +143,7 @@ public void findCustomerByIdTest(){
} }
``` ```
![image-20220426134717655](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220426134717655.png) ![image-20220426134717655](https://lsky.hhdxw.top/imghub/img/image-20220426134717655.png)
## 基于Mapper方式的整合 ## 基于Mapper方式的整合
@ -231,7 +231,7 @@ public void findCustomerById(){
} }
``` ```
![image-20220426135752830](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220426135752830.png) ![image-20220426135752830](https://lsky.hhdxw.top/imghub/img/image-20220426135752830.png)
虽然使用Mapper接口编程的方式很简单但是在具体使用时还是需要遵循以下规范。 虽然使用Mapper接口编程的方式很简单但是在具体使用时还是需要遵循以下规范。
@ -286,4 +286,4 @@ public void findCustomerById1(){
} }
``` ```
![image-20220427102429052](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220427102429052.png) ![image-20220427102429052](https://lsky.hhdxw.top/imghub/img/image-20220427102429052.png)

View File

@ -68,7 +68,7 @@ FirstController 类的包 实现HttpServletResponse HttpServletRequest两个方
首先在 java 下创建包 com.gzh.controller ,然后创建 FirstController 类,实现接口选择 Controller 第一个 首先在 java 下创建包 com.gzh.controller ,然后创建 FirstController 类,实现接口选择 Controller 第一个
![image-20220430213958181](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220430213958181.png) ![image-20220430213958181](https://lsky.hhdxw.top/imghub/img/image-20220430213958181.png)
```java ```java
public class FirstController implements Controller { public class FirstController implements Controller {
@ -130,33 +130,33 @@ public class FirstController implements Controller {
3选择 Tomcat 服务区 本地服务Local 本地 remote 远程服务) 3选择 Tomcat 服务区 本地服务Local 本地 remote 远程服务)
![image-20220430215445248](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220430215445248.png) ![image-20220430215445248](https://lsky.hhdxw.top/imghub/img/image-20220430215445248.png)
4点击配置服务器选择 Tomcat 服务器的主目录 4点击配置服务器选择 Tomcat 服务器的主目录
![image-20220430215956914](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220430215956914.png) ![image-20220430215956914](https://lsky.hhdxw.top/imghub/img/image-20220430215956914.png)
5点击部署点击添加服务选择工件Artifact 5点击部署点击添加服务选择工件Artifact
![image-20220430220220555](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220430220220555.png) ![image-20220430220220555](https://lsky.hhdxw.top/imghub/img/image-20220430220220555.png)
6随便选择一个即可 6随便选择一个即可
![image-20220430220452741](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220430220452741.png) ![image-20220430220452741](https://lsky.hhdxw.top/imghub/img/image-20220430220452741.png)
7最好将 应用程序上下文 改为项目名称 7最好将 应用程序上下文 改为项目名称
![image-20220430220832300](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220430220832300.png) ![image-20220430220832300](https://lsky.hhdxw.top/imghub/img/image-20220430220832300.png)
8然后启用服务器就可以了 8然后启用服务器就可以了
![image-20220430221340859](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220430221340859.png) ![image-20220430221340859](https://lsky.hhdxw.top/imghub/img/image-20220430221340859.png)
## 6.项目部署 ## 6.项目部署
`http://localhost:8080/c11/firstController` 链接中能够看到实现的语句 `http://localhost:8080/c11/firstController` 链接中能够看到实现的语句
![image-20220430221617115](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220430221617115.png) ![image-20220430221617115](https://lsky.hhdxw.top/imghub/img/image-20220430221617115.png)
项目根目录:`http://localhost:8080/c11/` 项目根目录:`http://localhost:8080/c11/`
@ -166,7 +166,7 @@ public class FirstController implements Controller {
![image-20220430221939788](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220430221939788.png) ![image-20220430221939788](https://lsky.hhdxw.top/imghub/img/image-20220430221939788.png)
1用户通过客户端向服务器发送请求请求会被Spring MVC的前端控制器DispatcherServlet所拦截。 1用户通过客户端向服务器发送请求请求会被Spring MVC的前端控制器DispatcherServlet所拦截。

View File

@ -147,11 +147,11 @@ public class MyController {
### 6.在tomcat服务器上部署项目 ### 6.在tomcat服务器上部署项目
![image-20220506092448960](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220506092448960.png) ![image-20220506092448960](https://lsky.hhdxw.top/imghub/img/image-20220506092448960.png)
### 7.成功发布项目 ### 7.成功发布项目
![image-20220506093333560](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220506093333560.png) ![image-20220506093333560](https://lsky.hhdxw.top/imghub/img/image-20220506093333560.png)
## 4.定义视图解析器(配置前后缀) ## 4.定义视图解析器(配置前后缀)
@ -188,4 +188,4 @@ public class MyController {
### 3.重新发布项目 ### 3.重新发布项目
![image-20220506094644157](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220506094644157.png) ![image-20220506094644157](https://lsky.hhdxw.top/imghub/img/image-20220506094644157.png)

View File

@ -113,7 +113,7 @@ success
#### 7.在 tomcat 服务器上部署项目,发布项目 #### 7.在 tomcat 服务器上部署项目,发布项目
![image-20220506220115521](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220506220115521.png) ![image-20220506220115521](https://lsky.hhdxw.top/imghub/img/image-20220506220115521.png)
#### 7.测试 发送: #### 7.测试 发送:
@ -121,7 +121,7 @@ success
http://localhost:8080/c15/selectUser?id=1 http://localhost:8080/c15/selectUser?id=1
``` ```
![image-20220506220059705](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220506220059705.png) ![image-20220506220059705](https://lsky.hhdxw.top/imghub/img/image-20220506220059705.png)
### 2简单的数据类型 int double float string ### 2简单的数据类型 int double float string
@ -141,7 +141,7 @@ public String getUser(int id) {
http://localhost:8080/c15/getUser?id=4 http://localhost:8080/c15/getUser?id=4
``` ```
![image-20220506221558058](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220506221558058.png) ![image-20220506221558058](https://lsky.hhdxw.top/imghub/img/image-20220506221558058.png)
@ -149,11 +149,11 @@ http://localhost:8080/c15/getUser?id=4
**getuser()** 中的参数 **i** 要和后面的一致,在绑定时也要进行相应更改 **getuser()** 中的参数 **i** 要和后面的一致,在绑定时也要进行相应更改
![image-20220506222128788](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220506222128788.png) ![image-20220506222128788](https://lsky.hhdxw.top/imghub/img/image-20220506222128788.png)
添加注解 **@RequestParam** 就可以将 **id** 参数的值绑定到 **a** 添加注解 **@RequestParam** 就可以将 **id** 参数的值绑定到 **a**
![image-20220506222455550](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220506222455550.png) ![image-20220506222455550](https://lsky.hhdxw.top/imghub/img/image-20220506222455550.png)
### 3POJO plain old Java object ### 3POJO plain old Java object
@ -200,7 +200,7 @@ public String registerUser(User user) {
#### 4.测试 发布 #### 4.测试 发布
![image-20220506223113983](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220506223113983.png) ![image-20220506223113983](https://lsky.hhdxw.top/imghub/img/image-20220506223113983.png)
在中文的情况下可能会发生乱码,所以添加编码过滤器,将所有文件用 utf-8 格式编码 在中文的情况下可能会发生乱码,所以添加编码过滤器,将所有文件用 utf-8 格式编码
@ -224,7 +224,7 @@ public String registerUser(User user) {
测试 发布:中文不会产生乱码 测试 发布:中文不会产生乱码
![image-20220506223612935](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220506223612935.png) ![image-20220506223612935](https://lsky.hhdxw.top/imghub/img/image-20220506223612935.png)
### 4包装的POJO类型 ### 4包装的POJO类型
@ -278,7 +278,7 @@ public class OrdersController {
#### 4.测试 发布 #### 4.测试 发布
![image-20220507091032381](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220507091032381.png) ![image-20220507091032381](https://lsky.hhdxw.top/imghub/img/image-20220507091032381.png)
## 3.复杂的数据绑定 ## 3.复杂的数据绑定
@ -333,11 +333,11 @@ public class OrdersController {
#### 3.测试 发布: #### 3.测试 发布:
![image-20220506224513695](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220506224513695.png) ![image-20220506224513695](https://lsky.hhdxw.top/imghub/img/image-20220506224513695.png)
![image-20220506224526191](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220506224526191.png) ![image-20220506224526191](https://lsky.hhdxw.top/imghub/img/image-20220506224526191.png)
### 2绑定集合 ### 2绑定集合
@ -407,4 +407,4 @@ private List<User> users;
#### 4.测试发布 #### 4.测试发布
![image-20220507121847120](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220507121847120.png) ![image-20220507121847120](https://lsky.hhdxw.top/imghub/img/image-20220507121847120.png)

View File

@ -134,7 +134,7 @@ private String password;
在webapp下创建文件夹 js 在文件夹下复制文件 在webapp下创建文件夹 js 在文件夹下复制文件
![image-20220513233035481](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220513233035481.png) ![image-20220513233035481](https://lsky.hhdxw.top/imghub/img/image-20220513233035481.png)
### 7.创建UserController方法 ### 7.创建UserController方法
@ -154,7 +154,7 @@ public class UserController {
### 8.发布项目 ### 8.发布项目
![image-20220513231414012](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220513231414012.png) ![image-20220513231414012](https://lsky.hhdxw.top/imghub/img/image-20220513231414012.png)
## 4.RESTful支持 ## 4.RESTful支持
@ -219,4 +219,4 @@ function search(){
### 3.发布项目 ### 3.发布项目
![image-20220513232938453](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220513232938453.png) ![image-20220513232938453](https://lsky.hhdxw.top/imghub/img/image-20220513232938453.png)

View File

@ -1 +1 @@
![](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220512145028013.png) ![](https://lsky.hhdxw.top/imghub/img/image-20220512145028013.png)

View File

@ -126,7 +126,7 @@ webapp下的jsp文件可以通过url直接访问
</body> </body>
``` ```
![image-20220517103654553](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220517103654553.png) ![image-20220517103654553](https://lsky.hhdxw.top/imghub/img/image-20220517103654553.png)
### 6.创建控制器 ### 6.创建控制器
@ -181,11 +181,11 @@ public class FileUploadController {
### 7.发布项目 ### 7.发布项目
![image-20220517105222969](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220517105222969.png) ![image-20220517105222969](https://lsky.hhdxw.top/imghub/img/image-20220517105222969.png)
![image-20220517105211357](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220517105211357.png) ![image-20220517105211357](https://lsky.hhdxw.top/imghub/img/image-20220517105211357.png)
![image-20220517105334825](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220517105334825.png) ![image-20220517105334825](https://lsky.hhdxw.top/imghub/img/image-20220517105334825.png)
## 2.文件下载 ## 2.文件下载
@ -275,8 +275,8 @@ public String getFilename(HttpServletRequest request,String filename) throws Exc
用第一个控制器,下载的文件不是中文名称 用第一个控制器,下载的文件不是中文名称
![image-20220517112749837](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220517112749837.png) ![image-20220517112749837](https://lsky.hhdxw.top/imghub/img/image-20220517112749837.png)
用第二个控制器,下载的文件是中文名称 用第二个控制器,下载的文件是中文名称
![image-20220517113013424](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220517113013424.png) ![image-20220517113013424](https://lsky.hhdxw.top/imghub/img/image-20220517113013424.png)

View File

@ -2,19 +2,19 @@
下面是一张SpringBoot的项目文件图其中项目是由`.mvn`、`src`、`target` 文件夹和`.getignore`、`HELP.md`、`mvnw`、`mvnw.cmd`、`pom.xml`、`untitled.iml`组成。(此项目是包含四个模块,模块均相同,不影响文件功能) 下面是一张SpringBoot的项目文件图其中项目是由`.mvn`、`src`、`target` 文件夹和`.getignore`、`HELP.md`、`mvnw`、`mvnw.cmd`、`pom.xml`、`untitled.iml`组成。(此项目是包含四个模块,模块均相同,不影响文件功能)
![image-20230301205134729](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20230301205134729.png) ![image-20230301205134729](https://lsky.hhdxw.top/imghub/img/image-20230301205134729.png)
### 1、.mvn ### 1、.mvn
`.mvn`是Spring Boot 生成,用于一键通过 **Maven**构建、编译、打包和部署的文件目录。内部结构如下: `.mvn`是Spring Boot 生成,用于一键通过 **Maven**构建、编译、打包和部署的文件目录。内部结构如下:
![image-20230301205529767](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20230301205529767.png) ![image-20230301205529767](https://lsky.hhdxw.top/imghub/img/image-20230301205529767.png)
### 2、src ### 2、src
![image-20230301205636397](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20230301205636397.png) ![image-20230301205636397](https://lsky.hhdxw.top/imghub/img/image-20230301205636397.png)
``` ```
├── main ├── main
@ -31,7 +31,7 @@
应用构建时生成,主要存放了源代码编译后的 class 文件,相关的配置文件以及打好的包文件等用于实际执行的文件。 应用构建时生成,主要存放了源代码编译后的 class 文件,相关的配置文件以及打好的包文件等用于实际执行的文件。
![image-20230301210547502](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20230301210547502.png) ![image-20230301210547502](https://lsky.hhdxw.top/imghub/img/image-20230301210547502.png)
### 4、.getignore ### 4、.getignore

View File

@ -11,7 +11,7 @@ tags:
最近在学习Spring的过程中遇到了一个棘手的问题使用Resource注解时报错了。 最近在学习Spring的过程中遇到了一个棘手的问题使用Resource注解时报错了。
![image-20220315214739187](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220315214739187.png) ![image-20220315214739187](https://lsky.hhdxw.top/imghub/img/image-20220315214739187.png)
当时上面的**@Resource**爆红,忘了截图 当时上面的**@Resource**爆红,忘了截图
@ -25,6 +25,6 @@ tags:
</dependency> </dependency>
``` ```
![image-20220315215743445](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220315215743445.png) ![image-20220315215743445](https://lsky.hhdxw.top/imghub/img/image-20220315215743445.png)
但是我用了这个方法没有用,依旧爆红,后来我换了**JDK**从16171.61.8,在最后**JDK9**能用了 但是我用了这个方法没有用,依旧爆红,后来我换了**JDK**从16171.61.8,在最后**JDK9**能用了

View File

@ -2,66 +2,66 @@
1.首先进入系统在右上角选择Settings进入设置带setting就是设置 1.首先进入系统在右上角选择Settings进入设置带setting就是设置
![image-20220316180407286](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220316180407286.png) ![image-20220316180407286](https://lsky.hhdxw.top/imghub/img/image-20220316180407286.png)
2.打开 setting 后找到左侧下面的 Language 点击进入后,打开右侧下方 Manage Installed Languages 进入语言添加设置 2.打开 setting 后找到左侧下面的 Language 点击进入后,打开右侧下方 Manage Installed Languages 进入语言添加设置
![image-20220316180503486](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220316180503486.png) ![image-20220316180503486](https://lsky.hhdxw.top/imghub/img/image-20220316180503486.png)
3.中途可能让你输入密码,输入密码回车即可 3.中途可能让你输入密码,输入密码回车即可
![image-20220316180631585](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220316180631585.png) ![image-20220316180631585](https://lsky.hhdxw.top/imghub/img/image-20220316180631585.png)
4.选择下面的 Install/Remove Languages 进入添加语言 4.选择下面的 Install/Remove Languages 进入添加语言
![image-20220316180947776](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220316180947776.png) ![image-20220316180947776](https://lsky.hhdxw.top/imghub/img/image-20220316180947776.png)
5.选择 Chinese simplified中文简体打上对勾然后点击Apply添加 5.选择 Chinese simplified中文简体打上对勾然后点击Apply添加
![image-20220316181016486](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220316181016486.png) ![image-20220316181016486](https://lsky.hhdxw.top/imghub/img/image-20220316181016486.png)
6.这个过程需要等待,安装可能会失败,重复上面的步骤 6.这个过程需要等待,安装可能会失败,重复上面的步骤
![image-20220316181104889](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220316181104889.png) ![image-20220316181104889](https://lsky.hhdxw.top/imghub/img/image-20220316181104889.png)
7.成功安装后会在上面的灰色栏内有显示需要滚动鼠标往下找 7.成功安装后会在上面的灰色栏内有显示需要滚动鼠标往下找
![image-20220316181138956](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220316181138956.png) ![image-20220316181138956](https://lsky.hhdxw.top/imghub/img/image-20220316181138956.png)
8.然后将中文提到最上面长按托拽点击Close退出 8.然后将中文提到最上面长按托拽点击Close退出
![image-20220316181211560](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220316181211560.png) ![image-20220316181211560](https://lsky.hhdxw.top/imghub/img/image-20220316181211560.png)
9.下面分别是语言设置,格式设置和输入法 三个依次进行更改 9.下面分别是语言设置,格式设置和输入法 三个依次进行更改
![image-20220316181259764](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220316181259764.png) ![image-20220316181259764](https://lsky.hhdxw.top/imghub/img/image-20220316181259764.png)
10.首先进入 Language 修改语言,选择 Chinese 然后Select 退出 10.首先进入 Language 修改语言,选择 Chinese 然后Select 退出
![image-20220316181334616](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220316181334616.png) ![image-20220316181334616](https://lsky.hhdxw.top/imghub/img/image-20220316181334616.png)
11.然后进入Formats设置格式选择China然后Done退出 11.然后进入Formats设置格式选择China然后Done退出
![image-20220316181409005](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220316181409005.png) ![image-20220316181409005](https://lsky.hhdxw.top/imghub/img/image-20220316181409005.png)
12.然后Restart重新启动系统 12.然后Restart重新启动系统
![image-20220316181715178](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220316181715178.png) ![image-20220316181715178](https://lsky.hhdxw.top/imghub/img/image-20220316181715178.png)
13.重启完后选择输入法更改,点击下面的加号(此时已经是中文界面了),点击汉语 13.重启完后选择输入法更改,点击下面的加号(此时已经是中文界面了),点击汉语
![image-20220316181858083](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220316181858083.png) ![image-20220316181858083](https://lsky.hhdxw.top/imghub/img/image-20220316181858083.png)
14.点击智能拼音,点击添加即可完成操作 14.点击智能拼音,点击添加即可完成操作
![image-20220316181920047](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220316181920047.png) ![image-20220316181920047](https://lsky.hhdxw.top/imghub/img/image-20220316181920047.png)
15.长按拖拽汉语放到第一个位置 15.长按拖拽汉语放到第一个位置
![image-20220316181953722](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220316181953722.png) ![image-20220316181953722](https://lsky.hhdxw.top/imghub/img/image-20220316181953722.png)
16.然后Ubuntu的中文设置已经做完了 16.然后Ubuntu的中文设置已经做完了
![image-20220316182042553](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220316182042553.png) ![image-20220316182042553](https://lsky.hhdxw.top/imghub/img/image-20220316182042553.png)
以上就是Ubuntu改中文操作教程 以上就是Ubuntu改中文操作教程

View File

@ -6,141 +6,141 @@
1.下载三个文件 VMware 16 PRO的安装包、激活码和 Ubuntu.iso 文件,解压后如图 1.下载三个文件 VMware 16 PRO的安装包、激活码和 Ubuntu.iso 文件,解压后如图
![img](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/wps4930.tmp.jpg) ![img](https://lsky.hhdxw.top/imghub/img/wps4930.tmp.jpg)
2.双击安装VMware 2.双击安装VMware
![img](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/wps4940.tmp.jpg) ![img](https://lsky.hhdxw.top/imghub/img/wps4940.tmp.jpg)
3.点击勾选协议,然后进行下一步操作 3.点击勾选协议,然后进行下一步操作
![img](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/wps4941.tmp.jpg) ![img](https://lsky.hhdxw.top/imghub/img/wps4941.tmp.jpg)
4.点击安装位置后面的更改,进行更改安装路径 4.点击安装位置后面的更改,进行更改安装路径
![img](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/wps4942.tmp.jpg) ![img](https://lsky.hhdxw.top/imghub/img/wps4942.tmp.jpg)
5.将安装路径改到 C 盘以外,防止 C 盘爆红,切记文件夹尽量用全**英文**或者**拼音**,不要用中文容易报错 5.将安装路径改到 C 盘以外,防止 C 盘爆红,切记文件夹尽量用全**英文**或者**拼音**,不要用中文容易报错
![img](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/wps4943.tmp.jpg) ![img](https://lsky.hhdxw.top/imghub/img/wps4943.tmp.jpg)
6.选择文件夹进行安装,然后确定 6.选择文件夹进行安装,然后确定
![img](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/wps4944.tmp.jpg) ![img](https://lsky.hhdxw.top/imghub/img/wps4944.tmp.jpg)
7.取消勾选启用更新和提升计划,然后下一步 7.取消勾选启用更新和提升计划,然后下一步
![img](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/wps4945.tmp.jpg) ![img](https://lsky.hhdxw.top/imghub/img/wps4945.tmp.jpg)
8.创建桌面图标,然后下一步 8.创建桌面图标,然后下一步
![img](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/wps4946.tmp.jpg) ![img](https://lsky.hhdxw.top/imghub/img/wps4946.tmp.jpg)
9.然后进行安装 9.然后进行安装
![img](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/wps4947.tmp.jpg) ![img](https://lsky.hhdxw.top/imghub/img/wps4947.tmp.jpg)
![img](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/wps4948.tmp.jpg) ![img](https://lsky.hhdxw.top/imghub/img/wps4948.tmp.jpg)
10.安装完成,选择许可证 10.安装完成,选择许可证
![img](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/wps4949.tmp.jpg) ![img](https://lsky.hhdxw.top/imghub/img/wps4949.tmp.jpg)
11.然后打开激活密钥文件,三行选一个就行,复制粘贴点击输入 11.然后打开激活密钥文件,三行选一个就行,复制粘贴点击输入
![img](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/wps494A.tmp.jpg) ![img](https://lsky.hhdxw.top/imghub/img/wps494A.tmp.jpg)
12.激活成功 12.激活成功
![img](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/wps494B.tmp.jpg) ![img](https://lsky.hhdxw.top/imghub/img/wps494B.tmp.jpg)
13.双击桌面图标打开VMware 13.双击桌面图标打开VMware
![img](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/wps494C.tmp.jpg) ![img](https://lsky.hhdxw.top/imghub/img/wps494C.tmp.jpg)
14.点击帮助框下面关于,检查是否完成激活 14.点击帮助框下面关于,检查是否完成激活
![img](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/wps494D.tmp.jpg) ![img](https://lsky.hhdxw.top/imghub/img/wps494D.tmp.jpg)
15.显示永久激活 VMware 完成配置以及激活 15.显示永久激活 VMware 完成配置以及激活
![img](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/wps494E.tmp.jpg) ![img](https://lsky.hhdxw.top/imghub/img/wps494E.tmp.jpg)
16.下面开始配置 Ubuntu 系统配置 16.下面开始配置 Ubuntu 系统配置
![img](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/wps495F.tmp.jpg) ![img](https://lsky.hhdxw.top/imghub/img/wps495F.tmp.jpg)
17.选择自定义设置 17.选择自定义设置
![img](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/wps4960.tmp.jpg) ![img](https://lsky.hhdxw.top/imghub/img/wps4960.tmp.jpg)
18.默认选择硬件,直接下一步 18.默认选择硬件,直接下一步
![img](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/wps4961.tmp.jpg) ![img](https://lsky.hhdxw.top/imghub/img/wps4961.tmp.jpg)
19.将下载的iso文件放到C盘以外的英文路径文件夹下 19.将下载的iso文件放到C盘以外的英文路径文件夹下
![image-20220316155220558](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220316155220558.png) ![image-20220316155220558](https://lsky.hhdxw.top/imghub/img/image-20220316155220558.png)
![image-20220316155251010](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220316155251010.png) ![image-20220316155251010](https://lsky.hhdxw.top/imghub/img/image-20220316155251010.png)
如上图即完成 如上图即完成
安装 Ubuntu 系统,选择安装光盘映像文件(路径尽量为**英文** 安装 Ubuntu 系统,选择安装光盘映像文件(路径尽量为**英文**
![image-20220316155420508](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220316155420508.png) ![image-20220316155420508](https://lsky.hhdxw.top/imghub/img/image-20220316155420508.png)
如下图即完成选择 如下图即完成选择
![image-20220316155452680](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220316155452680.png) ![image-20220316155452680](https://lsky.hhdxw.top/imghub/img/image-20220316155452680.png)
20.设置 linux 系统全名,以及用户名和密码(用户名和密码以简单为主,要牢记) 20.设置 linux 系统全名,以及用户名和密码(用户名和密码以简单为主,要牢记)
![img](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/wps4963.tmp.jpg) ![img](https://lsky.hhdxw.top/imghub/img/wps4963.tmp.jpg)
21.安装虚拟机路径(不要在 **C 盘**,路径尽量为**英文**),然后下一步 21.安装虚拟机路径(不要在 **C 盘**,路径尽量为**英文**),然后下一步
![img](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/wps4964.tmp.jpg) ![img](https://lsky.hhdxw.top/imghub/img/wps4964.tmp.jpg)
22.默认配置处理器数量,然后下一步 22.默认配置处理器数量,然后下一步
![img](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/wps4965.tmp.jpg) ![img](https://lsky.hhdxw.top/imghub/img/wps4965.tmp.jpg)
23.内存一般配置默认(不能超过电脑自身内存的一半) 23.内存一般配置默认(不能超过电脑自身内存的一半)
![img](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/wps4966.tmp.jpg) ![img](https://lsky.hhdxw.top/imghub/img/wps4966.tmp.jpg)
24.网络连接类型默认选项,下一步 24.网络连接类型默认选项,下一步
![img](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/wps4967.tmp.jpg) ![img](https://lsky.hhdxw.top/imghub/img/wps4967.tmp.jpg)
25.虚拟磁盘类型默认选项,下一步 25.虚拟磁盘类型默认选项,下一步
![img](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/wps4968.tmp.jpg) ![img](https://lsky.hhdxw.top/imghub/img/wps4968.tmp.jpg)
26.磁盘类型默认选项,下一步 26.磁盘类型默认选项,下一步
![img](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/wps4969.tmp.jpg) ![img](https://lsky.hhdxw.top/imghub/img/wps4969.tmp.jpg)
27.创建磁盘方式默认选项,下一步 27.创建磁盘方式默认选项,下一步
![img](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/wps496A.tmp.jpg) ![img](https://lsky.hhdxw.top/imghub/img/wps496A.tmp.jpg)
28.磁盘容量默认选项,下一步(要保证自己电脑的磁盘容量大于虚拟机磁盘容量) 28.磁盘容量默认选项,下一步(要保证自己电脑的磁盘容量大于虚拟机磁盘容量)
![img](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/wps496B.tmp.jpg) ![img](https://lsky.hhdxw.top/imghub/img/wps496B.tmp.jpg)
29.默认选项,下一步 29.默认选项,下一步
![img](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/wps496C.tmp.jpg) ![img](https://lsky.hhdxw.top/imghub/img/wps496C.tmp.jpg)
30.虚拟机配置总览,点击完成,进行安装 30.虚拟机配置总览,点击完成,进行安装
![img](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/wps496D.tmp.jpg) ![img](https://lsky.hhdxw.top/imghub/img/wps496D.tmp.jpg)
31.等待系统安装完成即可,部分电脑安装时间可能比较长,耐心等待即可 31.等待系统安装完成即可,部分电脑安装时间可能比较长,耐心等待即可
![img](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/wps496E.tmp.jpg) ![img](https://lsky.hhdxw.top/imghub/img/wps496E.tmp.jpg)
以上就是VMware 16PRO虚拟机破解安装以及 Ubuntu 系统配置如有其他问题可以QQ私我解决 以上就是VMware 16PRO虚拟机破解安装以及 Ubuntu 系统配置如有其他问题可以QQ私我解决

View File

@ -165,4 +165,4 @@ int main()
## 四、运行截图 ## 四、运行截图
![image-20220309100532330](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220309100532330.png) ![image-20220309100532330](https://lsky.hhdxw.top/imghub/img/image-20220309100532330.png)

View File

@ -25,7 +25,7 @@ tags:
![img](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/wps1700.tmp.jpg) ![img](https://lsky.hhdxw.top/imghub/img/wps1700.tmp.jpg)
## 三、代码实现如下: ## 三、代码实现如下:
@ -120,4 +120,4 @@ int main()
## 四、运行结果如下: ## 四、运行结果如下:
![image-20220309101417055](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220309101417055.png) ![image-20220309101417055](https://lsky.hhdxw.top/imghub/img/image-20220309101417055.png)

View File

@ -2,7 +2,7 @@
首先将背景图`bg`拷贝到`drawable` 首先将背景图`bg`拷贝到`drawable`
![bg](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/bg.png) ![bg](https://lsky.hhdxw.top/imghub/img/bg.png)
然后在`layout`文件下编写页面文件`activity_main.xml` 然后在`layout`文件下编写页面文件`activity_main.xml`
@ -94,7 +94,7 @@
</LinearLayout> </LinearLayout>
``` ```
![image-20221020093735433](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20221020093735433.png) ![image-20221020093735433](https://lsky.hhdxw.top/imghub/img/image-20221020093735433.png)
## 2.后端代码编写 ## 2.后端代码编写

View File

@ -172,7 +172,7 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
</LinearLayout> </LinearLayout>
``` ```
![image-20220920170834225](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220920170834225.png) ![image-20220920170834225](https://lsky.hhdxw.top/imghub/img/image-20220920170834225.png)
```java ```java
public class MainActivity extends AppCompatActivity { public class MainActivity extends AppCompatActivity {
@ -219,7 +219,7 @@ public class MainActivity extends AppCompatActivity {
演示: 演示:
![image-20220920170949644](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220920170949644.png) ![image-20220920170949644](https://lsky.hhdxw.top/imghub/img/image-20220920170949644.png)
### 6.CheckBox复选框 ### 6.CheckBox复选框
@ -258,7 +258,7 @@ public class MainActivity extends AppCompatActivity {
</LinearLayout> </LinearLayout>
``` ```
![image-20220920171135978](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220920171135978.png) ![image-20220920171135978](https://lsky.hhdxw.top/imghub/img/image-20220920171135978.png)
```java ```java
public class MainActivity extends AppCompatActivity implements CompoundButton.OnCheckedChangeListener { public class MainActivity extends AppCompatActivity implements CompoundButton.OnCheckedChangeListener {
@ -308,7 +308,7 @@ public class MainActivity extends AppCompatActivity implements CompoundButton.On
演示: 演示:
![image-20220920171302035](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220920171302035.png) ![image-20220920171302035](https://lsky.hhdxw.top/imghub/img/image-20220920171302035.png)
### 7.Toast信息提醒机制 ### 7.Toast信息提醒机制
@ -338,7 +338,7 @@ public class MainActivity extends AppCompatActivity implements CompoundButton.On
</LinearLayout> </LinearLayout>
``` ```
![image-20220922091511202](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220922091511202.png) ![image-20220922091511202](https://lsky.hhdxw.top/imghub/img/image-20220922091511202.png)
```java ```java
public class ToastActivity extends AppCompatActivity { public class ToastActivity extends AppCompatActivity {
@ -375,7 +375,7 @@ public class ToastActivity extends AppCompatActivity {
演示: 演示:
![image-20220922091555853](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220922091555853.png) ![image-20220922091555853](https://lsky.hhdxw.top/imghub/img/image-20220922091555853.png)
## 3.2AlertDialog对话框使用 ## 3.2AlertDialog对话框使用
@ -432,7 +432,7 @@ public class MainActivity extends AppCompatActivity {
} }
``` ```
![image-20221006082929853](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20221006082929853.png) ![image-20221006082929853](https://lsky.hhdxw.top/imghub/img/image-20221006082929853.png)
### 3.2.3单选对话框 ### 3.2.3单选对话框
@ -521,7 +521,7 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
} }
``` ```
![image-20221006082632884](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20221006082632884.png) ![image-20221006082632884](https://lsky.hhdxw.top/imghub/img/image-20221006082632884.png)
### 3.2.4多选对话框 ### 3.2.4多选对话框
@ -591,7 +591,7 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
} }
``` ```
![image-20221006083710559](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20221006083710559.png) ![image-20221006083710559](https://lsky.hhdxw.top/imghub/img/image-20221006083710559.png)
## 3.3 ListView的使用 ## 3.3 ListView的使用
@ -715,4 +715,4 @@ public class MainActivity extends AppCompatActivity {
} }
``` ```
![image-20221006083432016](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20221006083432016.png) ![image-20221006083432016](https://lsky.hhdxw.top/imghub/img/image-20221006083432016.png)

View File

@ -61,11 +61,11 @@
在包上右击选择 在包上右击选择
![image-20221004104302195](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20221004104302195.png) ![image-20221004104302195](https://lsky.hhdxw.top/imghub/img/image-20221004104302195.png)
一个页面对应一个布局文件 xml 一个页面对应一个布局文件 xml
![image-20221004104505572](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20221004104505572.png) ![image-20221004104505572](https://lsky.hhdxw.top/imghub/img/image-20221004104505572.png)
### 4.2.2 配置Activity ### 4.2.2 配置Activity
@ -167,7 +167,7 @@ public class MyActivity extends AppCompatActivity implements View.OnClickListene
</LinearLayout> </LinearLayout>
``` ```
![image-20221006123245336](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20221006123245336.png) ![image-20221006123245336](https://lsky.hhdxw.top/imghub/img/image-20221006123245336.png)
```java ```java
public class A extends AppCompatActivity implements View.OnClickListener { public class A extends AppCompatActivity implements View.OnClickListener {
@ -240,7 +240,7 @@ public class A extends AppCompatActivity implements View.OnClickListener {
</manifest> </manifest>
``` ```
![image-20221006123256251](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20221006123256251.png) ![image-20221006123256251](https://lsky.hhdxw.top/imghub/img/image-20221006123256251.png)
## 4.4 Activity之间的跳转 ## 4.4 Activity之间的跳转
@ -388,7 +388,7 @@ public class SecondActivity extends AppCompatActivity {
} }
``` ```
![image-20221011112153331](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20221011112153331.png) ![image-20221011112153331](https://lsky.hhdxw.top/imghub/img/image-20221011112153331.png)
### 4.4.2 Activity之间的数据回传 ### 4.4.2 Activity之间的数据回传

View File

@ -6,7 +6,7 @@
show databases; show databases;
``` ```
![image-20220308081529937](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220308081529937.png) ![image-20220308081529937](https://lsky.hhdxw.top/imghub/img/image-20220308081529937.png)
有名为yggl 的数据库了于是创建名为yggl2 的数据库来完成以下操作。 有名为yggl 的数据库了于是创建名为yggl2 的数据库来完成以下操作。
@ -22,7 +22,7 @@ create database yggl2;
use yggl2 use yggl2
``` ```
![image-20220308081928547](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220308081928547.png) ![image-20220308081928547](https://lsky.hhdxw.top/imghub/img/image-20220308081928547.png)
首先创建主表 departments涉及到外键所以先创建 首先创建主表 departments涉及到外键所以先创建
@ -36,7 +36,7 @@ note text(16) null
如下图,创建完成主表 departments 如下图,创建完成主表 departments
![image-20220308083216423](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220308083216423.png) ![image-20220308083216423](https://lsky.hhdxw.top/imghub/img/image-20220308083216423.png)
然后检查是否创建成功表 然后检查是否创建成功表
@ -44,7 +44,7 @@ note text(16) null
show tables; show tables;
``` ```
![image-20220308083338984](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220308083338984.png) ![image-20220308083338984](https://lsky.hhdxw.top/imghub/img/image-20220308083338984.png)
查看 departments 中各字段的内容 查看 departments 中各字段的内容
@ -54,7 +54,7 @@ describe departments;
desc departments; desc departments;
``` ```
![image-20220308083540263](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220308083540263.png) ![image-20220308083540263](https://lsky.hhdxw.top/imghub/img/image-20220308083540263.png)
创建从表 employees (day中不允许写长度) 创建从表 employees (day中不允许写长度)
@ -76,7 +76,7 @@ constraint fr_deptid foreign key(departmentid) references departments(department
创建完成如下图: 创建完成如下图:
![image-20220308085743344](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220308085743344.png) ![image-20220308085743344](https://lsky.hhdxw.top/imghub/img/image-20220308085743344.png)
创建表 salary 创建表 salary
@ -90,7 +90,7 @@ outcome float(8) not null
如图创建成功 如图创建成功
![image-20220308090204366](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220308090204366.png) ![image-20220308090204366](https://lsky.hhdxw.top/imghub/img/image-20220308090204366.png)
## 二、方法 ## 二、方法
@ -102,7 +102,7 @@ salary 修改前
salary2 修改后 salary2 修改后
``` ```
![image-20220308090629743](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220308090629743.png) ![image-20220308090629743](https://lsky.hhdxw.top/imghub/img/image-20220308090629743.png)
### 2.修改字段的数据类型modify ### 2.修改字段的数据类型modify
@ -113,7 +113,7 @@ name 字段名
varchar(20) 数据类型 varchar(20) 数据类型
``` ```
![image-20220308091240600](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220308091240600.png) ![image-20220308091240600](https://lsky.hhdxw.top/imghub/img/image-20220308091240600.png)
### 3.修改字段名change ### 3.修改字段名change
@ -126,7 +126,7 @@ varchar(20) 数据类型
//数据类型不能为空,但是可以和修改前一样,也可同时修改 //数据类型不能为空,但是可以和修改前一样,也可同时修改
``` ```
![image-20220308094202062](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220308094202062.png) ![image-20220308094202062](https://lsky.hhdxw.top/imghub/img/image-20220308094202062.png)
说明change 也可以指修改数据类型,实现和 modify 相同的效果,方法是将 sql 语句中的新字段名和旧字段名设置为相同的名称,只修改数据类型。 说明change 也可以指修改数据类型,实现和 modify 相同的效果,方法是将 sql 语句中的新字段名和旧字段名设置为相同的名称,只修改数据类型。
@ -142,7 +142,7 @@ first 添加表的位置 (可选项)
after 字段名 在字段名之后添加 after 字段名 在字段名之后添加
``` ```
![image-20220308094307879](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220308094307879.png) ![image-20220308094307879](https://lsky.hhdxw.top/imghub/img/image-20220308094307879.png)
### 5.删除字段 drop ### 5.删除字段 drop
@ -152,7 +152,7 @@ salary 表名
shuishou 字段名 shuishou 字段名
``` ```
![image-20220308094428794](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220308094428794.png) ![image-20220308094428794](https://lsky.hhdxw.top/imghub/img/image-20220308094428794.png)
### 6.修改字段排列顺序modify ### 6.修改字段排列顺序modify
@ -163,7 +163,7 @@ shuishou float 需修改顺序的字段名以及数据类型
income 目标字段之后first最前面 income 目标字段之后first最前面
``` ```
![image-20220308094400851](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220308094400851.png) ![image-20220308094400851](https://lsky.hhdxw.top/imghub/img/image-20220308094400851.png)
### 7.添加外键约束add ### 7.添加外键约束add
@ -203,7 +203,7 @@ alter table 表名 drop foreign key 外键名字;
查询到默认外键名后再用drop删除即可即 alter table 表名 drop foreign key 查询到的默认外键名; 查询到默认外键名后再用drop删除即可即 alter table 表名 drop foreign key 查询到的默认外键名;
![image-20220308110246033](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220308110246033.png) ![image-20220308110246033](https://lsky.hhdxw.top/imghub/img/image-20220308110246033.png)
### 11.删除数据表 ### 11.删除数据表
@ -213,4 +213,4 @@ drop table 表名;
**注意:当存在外键约束时,主表不能直接删除,需要先删除外键约束再删表** **注意:当存在外键约束时,主表不能直接删除,需要先删除外键约束再删表**
![image-20220308110515138](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220308110515138.png) ![image-20220308110515138](https://lsky.hhdxw.top/imghub/img/image-20220308110515138.png)

View File

@ -23,7 +23,7 @@ create table person(
desc person; desc person;
``` ```
![image-20220315081824424](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220315081824424.png) ![image-20220315081824424](https://lsky.hhdxw.top/imghub/img/image-20220315081824424.png)
查看表内数据 查看表内数据
@ -31,7 +31,7 @@ desc person;
select * from person; select * from person;
``` ```
![image-20220315082028785](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220315082028785.png) ![image-20220315082028785](https://lsky.hhdxw.top/imghub/img/image-20220315082028785.png)
插入数据 插入数据
@ -42,7 +42,7 @@ values(1,'Green',21,'lar');
查看数据 查看数据
![image-20220315082524826](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220315082524826.png) ![image-20220315082524826](https://lsky.hhdxw.top/imghub/img/image-20220315082524826.png)
插入数据 插入数据
@ -52,7 +52,7 @@ insert into person (id,age,name,info) values(2,22,'su','do');
查看数据 查看数据
![image-20220315082918594](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220315082918594.png) ![image-20220315082918594](https://lsky.hhdxw.top/imghub/img/image-20220315082918594.png)
插入数据 插入数据
@ -62,7 +62,7 @@ insert into person values(3,'wang',23,'ji');
查看数据 查看数据
![image-20220315083226414](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220315083226414.png) ![image-20220315083226414](https://lsky.hhdxw.top/imghub/img/image-20220315083226414.png)
插入数据 插入数据
@ -72,7 +72,7 @@ insert into person (age,name,info) values(32,'xu','deo');
查看数据 查看数据
![image-20220315083745218](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220315083745218.png) ![image-20220315083745218](https://lsky.hhdxw.top/imghub/img/image-20220315083745218.png)
插入指定字段 插入指定字段
@ -82,7 +82,7 @@ insert into person (name,age)values('wan',23);
insert into person (name)values('win'); insert into person (name)values('win');
``` ```
![image-20220315084255104](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220315084255104.png) ![image-20220315084255104](https://lsky.hhdxw.top/imghub/img/image-20220315084255104.png)
插入多条数据 插入多条数据
@ -93,7 +93,7 @@ values(26,'xi','dreo'),
(39,'vheng','dxu'); (39,'vheng','dxu');
``` ```
![image-20220315085241890](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220315085241890.png) ![image-20220315085241890](https://lsky.hhdxw.top/imghub/img/image-20220315085241890.png)
创建新表 创建新表
@ -113,7 +113,7 @@ insert into person2 (id,name,age,info2)
select * from person; select * from person;
``` ```
![image-20220315090756156](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220315090756156.png)、 ![image-20220315090756156](https://lsky.hhdxw.top/imghub/img/image-20220315090756156.png)、
更新数据 更新数据
@ -121,7 +121,7 @@ select * from person;
update person set age=15,name='liming' where id=9; update person set age=15,name='liming' where id=9;
``` ```
![image-20220315092323856](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220315092323856.png) ![image-20220315092323856](https://lsky.hhdxw.top/imghub/img/image-20220315092323856.png)
查询语句限制 查询语句限制
@ -131,9 +131,9 @@ select * from person where id=9;
select name from person where id=9; select name from person where id=9;
``` ```
![image-20220315092608371](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220315092608371.png) ![image-20220315092608371](https://lsky.hhdxw.top/imghub/img/image-20220315092608371.png)
![image-20220315092645199](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220315092645199.png) ![image-20220315092645199](https://lsky.hhdxw.top/imghub/img/image-20220315092645199.png)
查询年龄在19到25之间的人 查询年龄在19到25之间的人
@ -141,7 +141,7 @@ select name from person where id=9;
select * from person where age between 19 and 25; select * from person where age between 19 and 25;
``` ```
![image-20220315092906118](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220315092906118.png) ![image-20220315092906118](https://lsky.hhdxw.top/imghub/img/image-20220315092906118.png)
删除表中 id 为9的人 删除表中 id 为9的人
@ -149,7 +149,7 @@ select * from person where age between 19 and 25;
delete from person where id=9; delete from person where id=9;
``` ```
![image-20220315093201546](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220315093201546.png) ![image-20220315093201546](https://lsky.hhdxw.top/imghub/img/image-20220315093201546.png)
删除所有表中数据 删除所有表中数据
@ -157,7 +157,7 @@ delete from person where id=9;
delete from person; delete from person;
``` ```
![image-20220315093559445](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220315093559445.png) ![image-20220315093559445](https://lsky.hhdxw.top/imghub/img/image-20220315093559445.png)
## 一、插入数据 ## 一、插入数据

View File

@ -288,7 +288,7 @@ show database;
use text2; use text2;
``` ```
![image-20220317091555230](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220317091555230.png) ![image-20220317091555230](https://lsky.hhdxw.top/imghub/img/image-20220317091555230.png)
```mysql ```mysql
create table fruits( create table fruits(
@ -301,7 +301,7 @@ f_price decimal(8,2) not null
desc fruits; desc fruits;
``` ```
![image-20220317091623241](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220317091623241.png) ![image-20220317091623241](https://lsky.hhdxw.top/imghub/img/image-20220317091623241.png)
```mysql ```mysql
insert into fruits insert into fruits
@ -323,19 +323,19 @@ values('a1',101,'apple',10.2),
('b5',107,'xxx',3.6); ('b5',107,'xxx',3.6);
``` ```
![image-20220317092658984](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220317092658984.png) ![image-20220317092658984](https://lsky.hhdxw.top/imghub/img/image-20220317092658984.png)
```mysql ```mysql
select * from fruits; select * from fruits;
``` ```
![image-20220317092752192](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220317092752192.png) ![image-20220317092752192](https://lsky.hhdxw.top/imghub/img/image-20220317092752192.png)
```mysql ```mysql
select f_id,s_id,f_name,f_price from fruits; select f_id,s_id,f_name,f_price from fruits;
``` ```
![image-20220317093016313](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220317093016313.png) ![image-20220317093016313](https://lsky.hhdxw.top/imghub/img/image-20220317093016313.png)
```mysql ```mysql
select f_name,f_price from fruits where f_price=10.2; select f_name,f_price from fruits where f_price=10.2;
@ -343,164 +343,164 @@ select f_name,f_price from fruits where f_price>10.2;
select f_name,f_price from fruits where f_price<>10.2; select f_name,f_price from fruits where f_price<>10.2;
``` ```
![image-20220317095505644](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220317095505644.png) ![image-20220317095505644](https://lsky.hhdxw.top/imghub/img/image-20220317095505644.png)
```mysql ```mysql
select f_name,f_price from fruits where f_name='xxtt'; select f_name,f_price from fruits where f_name='xxtt';
``` ```
![image-20220317105627492](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220317105627492.png) ![image-20220317105627492](https://lsky.hhdxw.top/imghub/img/image-20220317105627492.png)
```mysql ```mysql
select f_name,f_price from fruits where f_price between 5 and 10; select f_name,f_price from fruits where f_price between 5 and 10;
``` ```
![image-20220317105740906](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220317105740906.png) ![image-20220317105740906](https://lsky.hhdxw.top/imghub/img/image-20220317105740906.png)
```mysql ```mysql
select s_id,f_name,f_price from fruits where s_id in(101,102); select s_id,f_name,f_price from fruits where s_id in(101,102);
``` ```
![image-20220317110130236](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220317110130236.png) ![image-20220317110130236](https://lsky.hhdxw.top/imghub/img/image-20220317110130236.png)
```mysql ```mysql
select s_id,f_name,f_price from fruits where s_id not in(101,103); select s_id,f_name,f_price from fruits where s_id not in(101,103);
``` ```
![image-20220317110406931](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220317110406931.png) ![image-20220317110406931](https://lsky.hhdxw.top/imghub/img/image-20220317110406931.png)
```mysql ```mysql
select f_name,f_price from fruits where f_price not between 5 and 10; select f_name,f_price from fruits where f_price not between 5 and 10;
``` ```
![image-20220317110825756](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220317110825756.png) ![image-20220317110825756](https://lsky.hhdxw.top/imghub/img/image-20220317110825756.png)
```mysql ```mysql
select f_name,f_price from fruits where f_name like 'b%'; select f_name,f_price from fruits where f_name like 'b%';
``` ```
![image-20220317111434067](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220317111434067.png) ![image-20220317111434067](https://lsky.hhdxw.top/imghub/img/image-20220317111434067.png)
```mysql ```mysql
select f_name,f_price from fruits where f_name like 'b%y'; select f_name,f_price from fruits where f_name like 'b%y';
``` ```
![image-20220317111958464](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220317111958464.png) ![image-20220317111958464](https://lsky.hhdxw.top/imghub/img/image-20220317111958464.png)
```mysql ```mysql
select f_name,f_price from fruits where f_name like '____y'; select f_name,f_price from fruits where f_name like '____y';
``` ```
![image-20220317112329201](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220317112329201.png) ![image-20220317112329201](https://lsky.hhdxw.top/imghub/img/image-20220317112329201.png)
```mysql ```mysql
select f_name,f_price from fruits where f_name is not null; select f_name,f_price from fruits where f_name is not null;
``` ```
![image-20220317112617170](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220317112617170.png) ![image-20220317112617170](https://lsky.hhdxw.top/imghub/img/image-20220317112617170.png)
```mysql ```mysql
select f_name,f_price from fruits where s_id=101 and f_price>=5; select f_name,f_price from fruits where s_id=101 and f_price>=5;
``` ```
![image-20220317113118208](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220317113118208.png) ![image-20220317113118208](https://lsky.hhdxw.top/imghub/img/image-20220317113118208.png)
```mysql ```mysql
select s_id,f_name,f_price from fruits where s_id=101 and f_price>=5 and f_name like 'a%'; select s_id,f_name,f_price from fruits where s_id=101 and f_price>=5 and f_name like 'a%';
``` ```
![image-20220317113224608](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220317113224608.png) ![image-20220317113224608](https://lsky.hhdxw.top/imghub/img/image-20220317113224608.png)
```mysql ```mysql
select s_id,f_name,f_price from fruits where s_id=101 or s_id=103; select s_id,f_name,f_price from fruits where s_id=101 or s_id=103;
``` ```
![image-20220317113342578](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220317113342578.png) ![image-20220317113342578](https://lsky.hhdxw.top/imghub/img/image-20220317113342578.png)
```mysql ```mysql
select distinct s_id from fruits ; select distinct s_id from fruits ;
``` ```
![image-20220317114237840](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220317114237840.png) ![image-20220317114237840](https://lsky.hhdxw.top/imghub/img/image-20220317114237840.png)
```mysql ```mysql
select distinct s_id from fruits order by s_id asc; select distinct s_id from fruits order by s_id asc;
select distinct s_id from fruits order by s_id desc; select distinct s_id from fruits order by s_id desc;
``` ```
![image-20220317114647937](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220317114647937.png) ![image-20220317114647937](https://lsky.hhdxw.top/imghub/img/image-20220317114647937.png)
```mysql ```mysql
select s_id,f_name from fruits order by f_name; select s_id,f_name from fruits order by f_name;
``` ```
![image-20220317114832832](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220317114832832.png) ![image-20220317114832832](https://lsky.hhdxw.top/imghub/img/image-20220317114832832.png)
```mysql ```mysql
select s_id,f_name from fruits order by s_id,f_name; select s_id,f_name from fruits order by s_id,f_name;
``` ```
![image-20220322072823107](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220322072823107.png) ![image-20220322072823107](https://lsky.hhdxw.top/imghub/img/image-20220322072823107.png)
```mysql ```mysql
select s_id,count(*) from fruits group by s_id; select s_id,count(*) from fruits group by s_id;
``` ```
![image-20220322073454144](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220322073454144.png) ![image-20220322073454144](https://lsky.hhdxw.top/imghub/img/image-20220322073454144.png)
```mysql ```mysql
select s_id,count(*) as total from fruits group by s_id; select s_id,count(*) as total from fruits group by s_id;
``` ```
![image-20220322073607034](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220322073607034.png) ![image-20220322073607034](https://lsky.hhdxw.top/imghub/img/image-20220322073607034.png)
```mysql ```mysql
select s_id,group_concat(f_name) from fruits group by s_id; select s_id,group_concat(f_name) from fruits group by s_id;
``` ```
![image-20220322074058744](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220322074058744.png) ![image-20220322074058744](https://lsky.hhdxw.top/imghub/img/image-20220322074058744.png)
```mysql ```mysql
select s_id,group_concat(f_name) as names from fruits group by s_id; select s_id,group_concat(f_name) as names from fruits group by s_id;
``` ```
![image-20220322074217309](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220322074217309.png) ![image-20220322074217309](https://lsky.hhdxw.top/imghub/img/image-20220322074217309.png)
```mysql ```mysql
select s_id,group_concat(f_name) as names from fruits group by s_id having count(f_name)>1; select s_id,group_concat(f_name) as names from fruits group by s_id having count(f_name)>1;
``` ```
![image-20220322074314665](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220322074314665.png) ![image-20220322074314665](https://lsky.hhdxw.top/imghub/img/image-20220322074314665.png)
```mysql ```mysql
select s_id,group_concat(f_name) as names from fruits where s_id>=104 group by s_id having count(f_name)>1; select s_id,group_concat(f_name) as names from fruits where s_id>=104 group by s_id having count(f_name)>1;
``` ```
![image-20220322075000501](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220322075000501.png) ![image-20220322075000501](https://lsky.hhdxw.top/imghub/img/image-20220322075000501.png)
```mysql ```mysql
select s_id,count(*) from fruits group by s_id with rollup; select s_id,count(*) from fruits group by s_id with rollup;
``` ```
![image-20220322080606749](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220322080606749.png) ![image-20220322080606749](https://lsky.hhdxw.top/imghub/img/image-20220322080606749.png)
```mysql ```mysql
select s_id,f_name,count(*) from fruits group by s_id,f_name; select s_id,f_name,count(*) from fruits group by s_id,f_name;
``` ```
![image-20220322080806489](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220322080806489.png) ![image-20220322080806489](https://lsky.hhdxw.top/imghub/img/image-20220322080806489.png)
```mysql ```mysql
select s_id,count(*) from fruits group by s_id order by s_id; select s_id,count(*) from fruits group by s_id order by s_id;
``` ```
![image-20220322081315975](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220322081315975.png) ![image-20220322081315975](https://lsky.hhdxw.top/imghub/img/image-20220322081315975.png)
```mysql ```mysql
select * from fruits limit 4,3; select * from fruits limit 4,3;
``` ```
![image-20220322081421227](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220322081421227.png) ![image-20220322081421227](https://lsky.hhdxw.top/imghub/img/image-20220322081421227.png)
```mysql ```mysql
create table orderitems( create table orderitems(
@ -513,7 +513,7 @@ primary key(o_num,o_item)
); );
``` ```
![image-20220322083305461](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220322083305461.png) ![image-20220322083305461](https://lsky.hhdxw.top/imghub/img/image-20220322083305461.png)
```mysql ```mysql
insert into orderitems insert into orderitems
@ -530,7 +530,7 @@ values(3001,1,'a1',10,5.20),
(3005,4,'m1',5,14.99); (3005,4,'m1',5,14.99);
``` ```
![image-20220322084023365](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220322084023365.png) ![image-20220322084023365](https://lsky.hhdxw.top/imghub/img/image-20220322084023365.png)
```mysql ```mysql
create table customers( create table customers(
@ -545,7 +545,7 @@ primary key(c_id)
); );
``` ```
![image-20220324071225242](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220324071225242.png) ![image-20220324071225242](https://lsky.hhdxw.top/imghub/img/image-20220324071225242.png)
``` ```
insert customers values insert customers values
@ -556,61 +556,61 @@ insert customers values
; ;
``` ```
![image-20220324071230024](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220324071230024.png) ![image-20220324071230024](https://lsky.hhdxw.top/imghub/img/image-20220324071230024.png)
```mysql ```mysql
select o_num,count(*) from orderitems group by o_num; select o_num,count(*) from orderitems group by o_num;
``` ```
![image-20220324072908786](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220324072908786.png) ![image-20220324072908786](https://lsky.hhdxw.top/imghub/img/image-20220324072908786.png)
```mysql ```mysql
select sum(quantity) from orderitems where o_num=3005; select sum(quantity) from orderitems where o_num=3005;
``` ```
![image-20220324073307965](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220324073307965.png) ![image-20220324073307965](https://lsky.hhdxw.top/imghub/img/image-20220324073307965.png)
```mysql ```mysql
select o_num,sum(quantity) from orderitems group by o_num; select o_num,sum(quantity) from orderitems group by o_num;
``` ```
![image-20220324073723595](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220324073723595.png) ![image-20220324073723595](https://lsky.hhdxw.top/imghub/img/image-20220324073723595.png)
```mysql ```mysql
select o_num,avg(item_price) from orderitems group by o_num; select o_num,avg(item_price) from orderitems group by o_num;
``` ```
![image-20220324074043677](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220324074043677.png) ![image-20220324074043677](https://lsky.hhdxw.top/imghub/img/image-20220324074043677.png)
```mysql ```mysql
select o_num,max(item_price) from orderitems group by o_num; select o_num,max(item_price) from orderitems group by o_num;
``` ```
![image-20220324074223916](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220324074223916.png) ![image-20220324074223916](https://lsky.hhdxw.top/imghub/img/image-20220324074223916.png)
```mysql ```mysql
select o_num,min(item_price) from orderitems group by o_num; select o_num,min(item_price) from orderitems group by o_num;
``` ```
![image-20220324074228364](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220324074228364.png) ![image-20220324074228364](https://lsky.hhdxw.top/imghub/img/image-20220324074228364.png)
```mysql ```mysql
select min(f_name) from fruits; select min(f_name) from fruits;
``` ```
![image-20220324074524338](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220324074524338.png) ![image-20220324074524338](https://lsky.hhdxw.top/imghub/img/image-20220324074524338.png)
```mysql ```mysql
在fruits中查询不同供应商供应的价格最低的水果 在fruits中查询不同供应商供应的价格最低的水果
select s_id,min(f_price) from fruits group by s_id; select s_id,min(f_price) from fruits group by s_id;
``` ```
![image-20220324074936488](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220324074936488.png) ![image-20220324074936488](https://lsky.hhdxw.top/imghub/img/image-20220324074936488.png)
```mysql ```mysql
select s_id,min(f_price) from fruits group by s_id order by s_id desc; select s_id,min(f_price) from fruits group by s_id order by s_id desc;
``` ```
![image-20220324075020970](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220324075020970.png) ![image-20220324075020970](https://lsky.hhdxw.top/imghub/img/image-20220324075020970.png)
# 底部 # 底部

View File

@ -18,7 +18,7 @@ create view 视图名 as 查询语句;
create view vt as select quantity,price,quantity*price from t; create view vt as select quantity,price,quantity*price from t;
``` ```
![image-20220405082050293](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220405082050293.png) ![image-20220405082050293](https://lsky.hhdxw.top/imghub/img/image-20220405082050293.png)
```mysql ```mysql
create view 视图名(表中列新名称) as 查询语句; create view 视图名(表中列新名称) as 查询语句;
@ -26,7 +26,7 @@ create view 视图名(表中列新名称) as 查询语句;
create view vt2(qty,p,total) as select quantity,price,quantity*price from t; create view vt2(qty,p,total) as select quantity,price,quantity*price from t;
``` ```
![image-20220405082320391](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220405082320391.png) ![image-20220405082320391](https://lsky.hhdxw.top/imghub/img/image-20220405082320391.png)
```mysql ```mysql
在多个表中创建视图 在多个表中创建视图
@ -43,7 +43,7 @@ create view vt4 as select stu.s_id,name,glass from stu join info on stu.s_id=inf
desc vt4; desc vt4;
``` ```
![image-20220405084010690](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220405084010690.png) ![image-20220405084010690](https://lsky.hhdxw.top/imghub/img/image-20220405084010690.png)
### 2.show table status like'视图名'语句查看视图的基本信息 ### 2.show table status like'视图名'语句查看视图的基本信息
@ -53,7 +53,7 @@ desc vt4;
show table status like 'vt4'; show table status like 'vt4';
``` ```
![image-20220405085355433](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220405085355433.png) ![image-20220405085355433](https://lsky.hhdxw.top/imghub/img/image-20220405085355433.png)
查询结果comment值为view说明该为视图其他大部分信息为null说明是一个虚表 查询结果comment值为view说明该为视图其他大部分信息为null说明是一个虚表
@ -63,7 +63,7 @@ show table status like 'vt4';
show table status like'stu'; show table status like'stu';
``` ```
![image-20220405085422810](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220405085422810.png) ![image-20220405085422810](https://lsky.hhdxw.top/imghub/img/image-20220405085422810.png)
查询结果包含了存储引擎、行数等信息comment信息为空这是表和视图查询结果的区别 查询结果包含了存储引擎、行数等信息comment信息为空这是表和视图查询结果的区别
@ -73,7 +73,7 @@ show table status like'stu';
show create view vt4; show create view vt4;
``` ```
![image-20220405090735295](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220405090735295.png) ![image-20220405090735295](https://lsky.hhdxw.top/imghub/img/image-20220405090735295.png)
### 4.在views表中查询所有视图 ### 4.在views表中查询所有视图
@ -93,7 +93,7 @@ create ro replace view 视图名 as 查询语句;
create ro replace view vt as select * from t; create ro replace view vt as select * from t;
``` ```
![image-20220405091444983](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220405091444983.png) ![image-20220405091444983](https://lsky.hhdxw.top/imghub/img/image-20220405091444983.png)
### 2.alter view ### 2.alter view
@ -103,7 +103,7 @@ alter view 视图名 as 查询语句;
alter view vt as select price from t; alter view vt as select price from t;
``` ```
![image-20220405091450188](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220405091450188.png) ![image-20220405091450188](https://lsky.hhdxw.top/imghub/img/image-20220405091450188.png)
### ###
@ -117,7 +117,7 @@ update 视图名 set 字段名=新值;
update vt set price=30; update vt set price=30;
``` ```
![image-20220405091758090](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220405091758090.png) ![image-20220405091758090](https://lsky.hhdxw.top/imghub/img/image-20220405091758090.png)
### 2.insert ### 2.insert
@ -127,7 +127,7 @@ insert into 视图名 values(数据);
insert into vt values(80); insert into vt values(80);
``` ```
![image-20220405092415253](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220405092415253.png) ![image-20220405092415253](https://lsky.hhdxw.top/imghub/img/image-20220405092415253.png)
### 3.delect ### 3.delect
@ -137,7 +137,7 @@ delete from 视图名 where 条件;
delete from vt where price=80; delete from vt where price=80;
``` ```
![image-20220405092640643](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220405092640643.png) ![image-20220405092640643](https://lsky.hhdxw.top/imghub/img/image-20220405092640643.png)
## 六、删除视图 ## 六、删除视图
@ -147,7 +147,7 @@ drop view 视图名;
drop view if exists vt; drop view if exists vt;
``` ```
![image-20220405093346162](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220405093346162.png) ![image-20220405093346162](https://lsky.hhdxw.top/imghub/img/image-20220405093346162.png)
## 七、综合案例 ## 七、综合案例

View File

@ -32,14 +32,14 @@ index (year_publication)
show create table book; show create table book;
``` ```
![image-20220407081946290](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220407081946290.png) ![image-20220407081946290](https://lsky.hhdxw.top/imghub/img/image-20220407081946290.png)
```mysql ```mysql
explain select * from book where year_publication=1990; explain select * from book where year_publication=1990;
//使用explain查看索引是否正在使用重点观察结果中的possible keys和key的值此处都为year_publication说明执行此查询语句时使用了索引 //使用explain查看索引是否正在使用重点观察结果中的possible keys和key的值此处都为year_publication说明执行此查询语句时使用了索引
``` ```
![image-20220407082155889](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220407082155889.png) ![image-20220407082155889](https://lsky.hhdxw.top/imghub/img/image-20220407082155889.png)
#### (2)唯一索引 #### (2)唯一索引
@ -57,7 +57,7 @@ unique index udid(id)
show create table t1; show create table t1;
``` ```
![image-20220407082821945](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220407082821945.png) ![image-20220407082821945](https://lsky.hhdxw.top/imghub/img/image-20220407082821945.png)
#### (3)组合索引 #### (3)组合索引
@ -77,7 +77,7 @@ explain select * from t3 where name='joy';
//查询时,必须遵从最左索引前缀原则 //查询时,必须遵从最左索引前缀原则
``` ```
![image-20220407084307684](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220407084307684.png) ![image-20220407084307684](https://lsky.hhdxw.top/imghub/img/image-20220407084307684.png)
#### (4)全文索引 只为字符charvarchartext索引 #### (4)全文索引 只为字符charvarchartext索引
@ -95,7 +95,7 @@ fulltext index (info)
show create table t4; show create table t4;
``` ```
![image-20220407091100882](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220407091100882.png) ![image-20220407091100882](https://lsky.hhdxw.top/imghub/img/image-20220407091100882.png)
#### (5)空间索引ENGIN=MyISAM #### (5)空间索引ENGIN=MyISAM
@ -119,7 +119,7 @@ alter table book add index(bookname);
show index from 表名; show index from 表名;
``` ```
![image-20220407091751882](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220407091751882.png) ![image-20220407091751882](https://lsky.hhdxw.top/imghub/img/image-20220407091751882.png)
#### (2)使用create index #### (2)使用create index
@ -138,7 +138,7 @@ alter table 表名 drop index 索引名;
alter table book drop index id; alter table book drop index id;
``` ```
![image-20220407093356011](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220407093356011.png) ![image-20220407093356011](https://lsky.hhdxw.top/imghub/img/image-20220407093356011.png)
### 2、使用drop index ### 2、使用drop index
@ -147,4 +147,4 @@ drop index 索引名 on 表名;
drop index bookname on book; drop index bookname on book;
``` ```
![image-20220407093437374](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220407093437374.png) ![image-20220407093437374](https://lsky.hhdxw.top/imghub/img/image-20220407093437374.png)

View File

@ -48,7 +48,7 @@ mysql -h local -u root -p
截图: 截图:
![img](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/wpsD882.tmp.jpg) ![img](https://lsky.hhdxw.top/imghub/img/wpsD882.tmp.jpg)
### 2创建数据库company并选择使用此数据库。 ### 2创建数据库company并选择使用此数据库。
@ -60,7 +60,7 @@ use company;
截图: 截图:
![img](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/wpsD883.tmp.jpg) ![img](https://lsky.hhdxw.top/imghub/img/wpsD883.tmp.jpg)
### 3创建表offices创建成功后用desc查看表结构。 ### 3创建表offices创建成功后用desc查看表结构。
@ -78,7 +78,7 @@ desc offices;
截图: 截图:
![img](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/wpsD884.tmp.jpg) ![img](https://lsky.hhdxw.top/imghub/img/wpsD884.tmp.jpg)
### 4创建表employees创建成功后用desc查看表结构。 ### 4创建表employees创建成功后用desc查看表结构。
@ -98,7 +98,7 @@ create table employees(
截图: 截图:
![image-20220308170243379](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220308170243379.png) ![image-20220308170243379](https://lsky.hhdxw.top/imghub/img/image-20220308170243379.png)
### 5使用show tables命令查看数据库中的表。 ### 5使用show tables命令查看数据库中的表。
@ -108,7 +108,7 @@ show tables
截图: 截图:
![image-20220308170414341](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220308170414341.png) ![image-20220308170414341](https://lsky.hhdxw.top/imghub/img/image-20220308170414341.png)
### 6将表employees的mobile字段修改到officecode字段后面成功后使用desc查看修改后的表结构。 ### 6将表employees的mobile字段修改到officecode字段后面成功后使用desc查看修改后的表结构。
@ -120,7 +120,7 @@ desc employees;
截图: 截图:
![image-20220308170720963](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220308170720963.png) ![image-20220308170720963](https://lsky.hhdxw.top/imghub/img/image-20220308170720963.png)
### 7将表employees的birth字段名改为employee_birth成功后使用desc查看修改后的表结构。 ### 7将表employees的birth字段名改为employee_birth成功后使用desc查看修改后的表结构。
@ -132,7 +132,7 @@ desc employees;
截图: 截图:
![image-20220308171008325](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220308171008325.png) ![image-20220308171008325](https://lsky.hhdxw.top/imghub/img/image-20220308171008325.png)
### 8修改sex字段数据类型为char(1)非空约束成功后使用desc查看修改后的表结构。 ### 8修改sex字段数据类型为char(1)非空约束成功后使用desc查看修改后的表结构。
@ -144,7 +144,7 @@ desc employees;
截图: 截图:
![image-20220308171528384](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220308171528384.png) ![image-20220308171528384](https://lsky.hhdxw.top/imghub/img/image-20220308171528384.png)
### 9删除字段note成功后使用desc查看修改后的表结构。 ### 9删除字段note成功后使用desc查看修改后的表结构。
@ -156,7 +156,7 @@ desc employees;
截图: 截图:
![image-20220308171326509](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220308171326509.png) ![image-20220308171326509](https://lsky.hhdxw.top/imghub/img/image-20220308171326509.png)
### 10增加字段名favoriate_activity数据类型为varchar(100) 成功后使用desc查看修改后的表结构。 ### 10增加字段名favoriate_activity数据类型为varchar(100) 成功后使用desc查看修改后的表结构。
@ -168,7 +168,7 @@ desc employees;
截图: 截图:
![image-20220308171746485](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220308171746485.png) ![image-20220308171746485](https://lsky.hhdxw.top/imghub/img/image-20220308171746485.png)
### 11删除表offices操作成功后用show tables查看数据库中的表。 ### 11删除表offices操作成功后用show tables查看数据库中的表。
@ -184,7 +184,7 @@ show tables;
截图: 截图:
![image-20220308172132982](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220308172132982.png) ![image-20220308172132982](https://lsky.hhdxw.top/imghub/img/image-20220308172132982.png)
### 12修改表employees存储引擎为myisam执行成功后用show create table语句查看表结构。 ### 12修改表employees存储引擎为myisam执行成功后用show create table语句查看表结构。
@ -196,7 +196,7 @@ show create table employees;
截图: 截图:
![image-20220308172645359](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220308172645359.png) ![image-20220308172645359](https://lsky.hhdxw.top/imghub/img/image-20220308172645359.png)
### 13将表employees名称修改为employees_info执行成功后用show tables查看数据库中的表。 ### 13将表employees名称修改为employees_info执行成功后用show tables查看数据库中的表。
@ -208,4 +208,4 @@ show tables;
截图: 截图:
![image-20220308172838692](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220308172838692.png) ![image-20220308172838692](https://lsky.hhdxw.top/imghub/img/image-20220308172838692.png)

View File

@ -46,7 +46,7 @@ mysql -h localhost -u root -p
截图: 截图:
![img](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/wps4BC6.tmp.jpg) ![img](https://lsky.hhdxw.top/imghub/img/wps4BC6.tmp.jpg)
2创建数据库M_BOOK并选择使用此数据库。 2创建数据库M_BOOK并选择使用此数据库。
@ -57,7 +57,7 @@ desc M_BOOK;
截图: 截图:
![image-20220315141208398](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220315141208398.png) ![image-20220315141208398](https://lsky.hhdxw.top/imghub/img/image-20220315141208398.png)
3按照表1创建表books创建成功后用desc查看表结构。 3按照表1创建表books创建成功后用desc查看表结构。
@ -76,7 +76,7 @@ create table books(
截图: 截图:
![image-20220315142332615](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220315142332615.png) ![image-20220315142332615](https://lsky.hhdxw.top/imghub/img/image-20220315142332615.png)
4使用select语句查询表中的数据此处查询结果应为空 4使用select语句查询表中的数据此处查询结果应为空
@ -86,7 +86,7 @@ select * from books;
截图: 截图:
![image-20220315142310880](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220315142310880.png) ![image-20220315142310880](https://lsky.hhdxw.top/imghub/img/image-20220315142310880.png)
5将表2中的记录插入到books表中分别使用不同的方法插入记录。 5将表2中的记录插入到books表中分别使用不同的方法插入记录。
@ -99,7 +99,7 @@ select * from books;
截图: 截图:
![image-20220315142912049](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220315142912049.png) ![image-20220315142912049](https://lsky.hhdxw.top/imghub/img/image-20220315142912049.png)
②不指定字段名插入第2行记录插入后用select语句查询插入结果 ②不指定字段名插入第2行记录插入后用select语句查询插入结果
@ -110,7 +110,7 @@ select * from books;
截图: 截图:
![image-20220315143315288](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220315143315288.png) ![image-20220315143315288](https://lsky.hhdxw.top/imghub/img/image-20220315143315288.png)
③同时插入第3~7行记录插入后用select语句查询插入结果 ③同时插入第3~7行记录插入后用select语句查询插入结果
@ -125,7 +125,7 @@ values (3,'Story of Jane','Jane Tim',40,2001,'novel',0),
截图: 截图:
![image-20220315144009242](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220315144009242.png) ![image-20220315144009242](https://lsky.hhdxw.top/imghub/img/image-20220315144009242.png)
6使用select语句查询小说类型novel的书的所有信息。 6使用select语句查询小说类型novel的书的所有信息。
@ -135,7 +135,7 @@ select * from books where note='novel';
截图: 截图:
![image-20220315144355595](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220315144355595.png) ![image-20220315144355595](https://lsky.hhdxw.top/imghub/img/image-20220315144355595.png)
7将小说类型novel的书的价格都增加5并在更新后使用select语句查询小说类型novel的书的所有信息 7将小说类型novel的书的价格都增加5并在更新后使用select语句查询小说类型novel的书的所有信息
@ -146,7 +146,7 @@ select * from books where note='novel';
截图: 截图:
![image-20220315145957535](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220315145957535.png) ![image-20220315145957535](https://lsky.hhdxw.top/imghub/img/image-20220315145957535.png)
8使用select语句查看书名为EmmaT的信息 8使用select语句查看书名为EmmaT的信息
@ -156,7 +156,7 @@ select * from books where b_name='EmmaT';
截图: 截图:
![image-20220315150138907](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220315150138907.png) ![image-20220315150138907](https://lsky.hhdxw.top/imghub/img/image-20220315150138907.png)
9将名为EmmaT的书价格改为40并使用select语句查询更新后的该书信息。 9将名为EmmaT的书价格改为40并使用select语句查询更新后的该书信息。
@ -167,7 +167,7 @@ select * from books where b_name='EmmaT';
截图: 截图:
![image-20220315150252053](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220315150252053.png) ![image-20220315150252053](https://lsky.hhdxw.top/imghub/img/image-20220315150252053.png)
10查询库存量为0的书的所有信息。 10查询库存量为0的书的所有信息。
@ -177,7 +177,7 @@ select * from books where num=0;
截图: 截图:
![image-20220315150322666](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220315150322666.png) ![image-20220315150322666](https://lsky.hhdxw.top/imghub/img/image-20220315150322666.png)
11删除库存量为0的书的所有信息并使用select语句查询库存量为0的书的所有信息此处应为空 11删除库存量为0的书的所有信息并使用select语句查询库存量为0的书的所有信息此处应为空
@ -188,4 +188,4 @@ select * from books where num=0;
截图: 截图:
![image-20220315150431488](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220315150431488.png) ![image-20220315150431488](https://lsky.hhdxw.top/imghub/img/image-20220315150431488.png)

View File

@ -72,7 +72,7 @@ mysql -h localhost -u root -p
截图: 截图:
![image-20220329093954268](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220329093954268.png) ![image-20220329093954268](https://lsky.hhdxw.top/imghub/img/image-20220329093954268.png)
2创建数据库MANGER并选择使用此数据库。 2创建数据库MANGER并选择使用此数据库。
@ -83,7 +83,7 @@ use MANGER;
截图: 截图:
![image-20220329094314369](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220329094314369.png) ![image-20220329094314369](https://lsky.hhdxw.top/imghub/img/image-20220329094314369.png)
3按照表1、表2创建表employee和dept创建成功后用desc查看表结构。 3按照表1、表2创建表employee和dept创建成功后用desc查看表结构。
@ -114,9 +114,9 @@ desc employee;
截图: 截图:
![image-20220329094933122](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220329094933122.png) ![image-20220329094933122](https://lsky.hhdxw.top/imghub/img/image-20220329094933122.png)
![image-20220329101229507](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220329101229507.png) ![image-20220329101229507](https://lsky.hhdxw.top/imghub/img/image-20220329101229507.png)
4将表3、表4的记录分别插入两个表中。 4将表3、表4的记录分别插入两个表中。
@ -146,9 +146,9 @@ values(1001,'Smith','m',20,'clerk',800,'2005-11-12'),
截图: 截图:
![image-20220329155245302](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220329155245302.png) ![image-20220329155245302](https://lsky.hhdxw.top/imghub/img/image-20220329155245302.png)
![image-20220329155332888](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220329155332888.png) ![image-20220329155332888](https://lsky.hhdxw.top/imghub/img/image-20220329155332888.png)
5在employee表中查询所有记录的e_no、e_name和e_salary字段值。 5在employee表中查询所有记录的e_no、e_name和e_salary字段值。
@ -158,7 +158,7 @@ select e_no,e_name,e_salary from employee;
截图: 截图:
![image-20220329155628020](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220329155628020.png) ![image-20220329155628020](https://lsky.hhdxw.top/imghub/img/image-20220329155628020.png)
6在employee表中查询dept_no等于10和20的所有记录。 6在employee表中查询dept_no等于10和20的所有记录。
@ -168,7 +168,7 @@ select * from employee where dept_no=10 or dept_no=20;
截图: 截图:
![image-20220329155759471](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220329155759471.png) ![image-20220329155759471](https://lsky.hhdxw.top/imghub/img/image-20220329155759471.png)
7在employee表中查询工资范围在800~2500之间的员工信息。 7在employee表中查询工资范围在800~2500之间的员工信息。
@ -178,7 +178,7 @@ select * from employee where e_salary>=800 and e_salary<=2500;
截图: 截图:
![image-20220329155930614](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220329155930614.png) ![image-20220329155930614](https://lsky.hhdxw.top/imghub/img/image-20220329155930614.png)
8在employee表中查询部门编号为20的部门中的员工所有信息。 8在employee表中查询部门编号为20的部门中的员工所有信息。
@ -188,7 +188,7 @@ select * from employee where dept_no=20;
截图: 截图:
![image-20220329160154098](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220329160154098.png) ![image-20220329160154098](https://lsky.hhdxw.top/imghub/img/image-20220329160154098.png)
9在employee表中查询每个部门最高工资的员工信息。 9在employee表中查询每个部门最高工资的员工信息。
@ -198,7 +198,7 @@ select *,max(e_salary) from employee group by dept_no;
截图: 截图:
![image-20220329160825143](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220329160825143.png) ![image-20220329160825143](https://lsky.hhdxw.top/imghub/img/image-20220329160825143.png)
10查询员工Blake所在部门编号和部门所在地。 10查询员工Blake所在部门编号和部门所在地。
@ -208,7 +208,7 @@ select d_name,d_location from dept as de where de.d_no=(select dept_no from empl
截图: 截图:
![image-20220329164419168](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220329164419168.png) ![image-20220329164419168](https://lsky.hhdxw.top/imghub/img/image-20220329164419168.png)
11使用连接查询查询所有员工的部门和和部门信息。 11使用连接查询查询所有员工的部门和和部门信息。
@ -218,7 +218,7 @@ select * from employee as em,dept as de where de.d_no=em.dept_no;
截图: 截图:
![image-20220329163914411](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220329163914411.png) ![image-20220329163914411](https://lsky.hhdxw.top/imghub/img/image-20220329163914411.png)
12在employee表中计算每个部门各有多少名员工。 12在employee表中计算每个部门各有多少名员工。
@ -228,7 +228,7 @@ select count(e_name),dept_no from employee group by dept_no;
截图: 截图:
![image-20220329164610824](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220329164610824.png) ![image-20220329164610824](https://lsky.hhdxw.top/imghub/img/image-20220329164610824.png)
13在employee表中计算不同类型职工的总工资数。 13在employee表中计算不同类型职工的总工资数。
@ -238,7 +238,7 @@ select e_job,sum(e_salary) from employee group by e_job;
截图: 截图:
![image-20220329161757013](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220329161757013.png) ![image-20220329161757013](https://lsky.hhdxw.top/imghub/img/image-20220329161757013.png)
14在employee表中计算不同部门的平均工资。 14在employee表中计算不同部门的平均工资。
@ -248,7 +248,7 @@ select dept_no,avg(e_salary) from employee group by dept_no;
截图: 截图:
![image-20220329162920630](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220329162920630.png) ![image-20220329162920630](https://lsky.hhdxw.top/imghub/img/image-20220329162920630.png)
15在employee表中查询工资低于1500的员工信息。 15在employee表中查询工资低于1500的员工信息。
@ -258,7 +258,7 @@ select * from employee where e_salary<1500;
截图: 截图:
![image-20220329163014313](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220329163014313.png) ![image-20220329163014313](https://lsky.hhdxw.top/imghub/img/image-20220329163014313.png)
16在employee表中将查询记录先按部门编号由高到低排列若部门相同再按员工工资由高到低排列。 16在employee表中将查询记录先按部门编号由高到低排列若部门相同再按员工工资由高到低排列。
@ -268,7 +268,7 @@ select * from employee order by dept_no desc,e_salary desc;
截图: 截图:
![image-20220329165111978](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220329165111978.png) ![image-20220329165111978](https://lsky.hhdxw.top/imghub/img/image-20220329165111978.png)
17在employee表中查询员工姓名以字母A或S开头的员工信息。 17在employee表中查询员工姓名以字母A或S开头的员工信息。
@ -278,7 +278,7 @@ select * from employee where e_name like 'A%' or e_name like 'S%';
截图: 截图:
![image-20220329163253424](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220329163253424.png) ![image-20220329163253424](https://lsky.hhdxw.top/imghub/img/image-20220329163253424.png)
18在employee表中查询到目前为止工龄大于等于20年的员工信息。 18在employee表中查询到目前为止工龄大于等于20年的员工信息。
@ -288,4 +288,4 @@ select * from employee as em where (select year(now())-(select year(em.hiredate)
截图: 截图:
![image-20220329165903364](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220329165903364.png) ![image-20220329165903364](https://lsky.hhdxw.top/imghub/img/image-20220329165903364.png)

View File

@ -84,7 +84,7 @@ mysql -u root -p
截图: 截图:
![image-20220405094500300](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220405094500300.png) ![image-20220405094500300](https://lsky.hhdxw.top/imghub/img/image-20220405094500300.png)
2创建数据库stu_exam并选择使用此数据库。 2创建数据库stu_exam并选择使用此数据库。
```mysql ```mysql
@ -94,7 +94,7 @@ use stu_exam;
截图: 截图:
![image-20220405094539472](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220405094539472.png) ![image-20220405094539472](https://lsky.hhdxw.top/imghub/img/image-20220405094539472.png)
3按照表1、表2、表3创建表创建成功后用desc查看表结构。 3按照表1、表2、表3创建表创建成功后用desc查看表结构。
@ -129,7 +129,7 @@ primary key(序号)
截图: 截图:
![image-20220405160214782](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220405160214782.png) ![image-20220405160214782](https://lsky.hhdxw.top/imghub/img/image-20220405160214782.png)
4将表4、表5、表6的记录分别插入三个表中。 4将表4、表5、表6的记录分别插入三个表中。
@ -156,7 +156,7 @@ insert into stu_mark values
截图: 截图:
![image-20220405161410429](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220405161410429.png) ![image-20220405161410429](https://lsky.hhdxw.top/imghub/img/image-20220405161410429.png)
5创建考上北大的学生视图视图中包含序号、姓名、分数和报名学校 5创建考上北大的学生视图视图中包含序号、姓名、分数和报名学校
@ -170,7 +170,7 @@ where stu_mark.序号=sign.序号 and sign.报名学校='北大' and stu_mark.
截图: 截图:
![image-20220406200815038](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220406200815038.png) ![image-20220406200815038](https://lsky.hhdxw.top/imghub/img/image-20220406200815038.png)
6创建考上清华的学生视图视图中包含序号、姓名、分数和报名学校 6创建考上清华的学生视图视图中包含序号、姓名、分数和报名学校
@ -184,7 +184,7 @@ where stu_mark.序号=sign.序号 and sign.报名学校='清华' and stu_mark.
截图: 截图:
![image-20220406201123556](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220406201123556.png) ![image-20220406201123556](https://lsky.hhdxw.top/imghub/img/image-20220406201123556.png)
7小田的成绩在录入的时候录入错误多录了50分对其录入成绩进行更新。 7小田的成绩在录入的时候录入错误多录了50分对其录入成绩进行更新。
@ -194,7 +194,7 @@ update 清华 set 分数=分数-50 where 姓名='小田';
截图: 截图:
![image-20220405163009861](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220405163009861.png) ![image-20220405163009861](https://lsky.hhdxw.top/imghub/img/image-20220405163009861.png)
8查询更新过后的视图和表的情况。 8查询更新过后的视图和表的情况。
@ -205,7 +205,7 @@ select * from stu_mark;
截图: 截图:
![image-20220406201156824](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220406201156824.png) ![image-20220406201156824](https://lsky.hhdxw.top/imghub/img/image-20220406201156824.png)
9查看视图的创建信息。 9查看视图的创建信息。
@ -216,7 +216,7 @@ show table status like '清华';
截图: 截图:
![image-20220405163228521](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220405163228521.png) ![image-20220405163228521](https://lsky.hhdxw.top/imghub/img/image-20220405163228521.png)
10删除创建的视图。 10删除创建的视图。
@ -227,4 +227,4 @@ drop view if exists 清华;
截图: 截图:
![image-20220405163346868](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220405163346868.png) ![image-20220405163346868](https://lsky.hhdxw.top/imghub/img/image-20220405163346868.png)

View File

@ -49,7 +49,7 @@ use index_test;
截图: 截图:
![image-20220407094114402](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220407094114402.png) ![image-20220407094114402](https://lsky.hhdxw.top/imghub/img/image-20220407094114402.png)
3按照表1创建test_table1表并在建表的同时创建如下索引在id上创建名称为UniqIdxid的唯一索引在name(长度20),address(长度30)上创建名称为MultiColIdx的组合索引在description(长度30)上创建名称为ComIdx的普通索引。 3按照表1创建test_table1表并在建表的同时创建如下索引在id上创建名称为UniqIdxid的唯一索引在name(长度20),address(长度30)上创建名称为MultiColIdx的组合索引在description(长度30)上创建名称为ComIdx的普通索引。
```mysql ```mysql
@ -66,7 +66,7 @@ index ComIdx(description(30))
截图: 截图:
![image-20220407101245380](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220407101245380.png) ![image-20220407101245380](https://lsky.hhdxw.top/imghub/img/image-20220407101245380.png)
4使用show语句查看索引信息。 4使用show语句查看索引信息。
```mysql ```mysql
@ -75,7 +75,7 @@ show index from test_table1;
截图: 截图:
![image-20220407101300158](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220407101300158.png) ![image-20220407101300158](https://lsky.hhdxw.top/imghub/img/image-20220407101300158.png)
5按照表2创建表test_table2存储引擎为MyISAM。 5按照表2创建表test_table2存储引擎为MyISAM。
```mysql ```mysql
@ -92,7 +92,7 @@ primary key(id)
截图: 截图:
![image-20220407100253683](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220407100253683.png) ![image-20220407100253683](https://lsky.hhdxw.top/imghub/img/image-20220407100253683.png)
6使用alter table语句在test_table2的birth字段上建立名称为ComDateIdx的普通索引 6使用alter table语句在test_table2的birth字段上建立名称为ComDateIdx的普通索引
```mysql ```mysql
@ -101,7 +101,7 @@ alter table test_table2 add index ComDateIdx(birth);
截图: 截图:
![image-20220407100726287](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220407100726287.png) ![image-20220407100726287](https://lsky.hhdxw.top/imghub/img/image-20220407100726287.png)
7使用alter table语句在test_table2的id字段上添加名称为UniqIdx2的唯一索引并以降序排列。 7使用alter table语句在test_table2的id字段上添加名称为UniqIdx2的唯一索引并以降序排列。
```mysql ```mysql
@ -110,7 +110,7 @@ alter table test_table2 add unique index UniqIdx2(id);
截图: 截图:
![image-20220407100738304](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220407100738304.png) ![image-20220407100738304](https://lsky.hhdxw.top/imghub/img/image-20220407100738304.png)
8使用create index在firstname、middlename和lastname 3个字段上建立名称为MultiColIdx2的组合索引。 8使用create index在firstname、middlename和lastname 3个字段上建立名称为MultiColIdx2的组合索引。
```mysql ```mysql
@ -119,7 +119,7 @@ create index MultiColIdx2 on test_table2(firstname,middlename,lastname);
截图: 截图:
![image-20220407100905384](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220407100905384.png) ![image-20220407100905384](https://lsky.hhdxw.top/imghub/img/image-20220407100905384.png)
9使用create index在title字段上建立名称为FTIdx的全文索引 9使用create index在title字段上建立名称为FTIdx的全文索引
```mysql ```mysql
@ -128,7 +128,7 @@ create fulltext index FTIdx on test_table2(title);
截图: 截图:
![image-20220407101003860](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220407101003860.png) ![image-20220407101003860](https://lsky.hhdxw.top/imghub/img/image-20220407101003860.png)
10使用alter table语句删除表test_table1中名称为UniqIdx的唯一索引。 10使用alter table语句删除表test_table1中名称为UniqIdx的唯一索引。
```mysql ```mysql
@ -137,7 +137,7 @@ alter table test_table1 drop index UniqIdx;
截图: 截图:
![image-20220407101326523](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220407101326523.png) ![image-20220407101326523](https://lsky.hhdxw.top/imghub/img/image-20220407101326523.png)
11使用drop index语句删除表test_table2中名称为MultiColIdx2的组合索引。 11使用drop index语句删除表test_table2中名称为MultiColIdx2的组合索引。
```mysql ```mysql
@ -146,4 +146,4 @@ drop index MultiColIdx2 on test_table2;
截图: 截图:
![image-20220407101408468](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220407101408468.png) ![image-20220407101408468](https://lsky.hhdxw.top/imghub/img/image-20220407101408468.png)

View File

@ -34,7 +34,7 @@ create table student_info(
); );
``` ```
![image-20220923104156917](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/202209231042251.png) ![image-20220923104156917](https://lsky.hhdxw.top/imghub/img/202209231042251.png)
表2 表结构 表2 表结构
@ -52,7 +52,7 @@ create table curriculum(
); );
``` ```
![截屏2022-09-23 10.43.40](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/%E6%88%AA%E5%B1%8F2022-09-23%2010.43.40.png) ![截屏2022-09-23 10.43.40](https://lsky.hhdxw.top/imghub/img/%E6%88%AA%E5%B1%8F2022-09-23%2010.43.40.png)
表3 grade表结构 表3 grade表结构
@ -71,7 +71,7 @@ PRIMARY KEY(学号,课程编号)
); );
``` ```
![截屏2022-09-23 10.44.15](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/%E6%88%AA%E5%B1%8F2022-09-23%2010.44.15.png) ![截屏2022-09-23 10.44.15](https://lsky.hhdxw.top/imghub/img/%E6%88%AA%E5%B1%8F2022-09-23%2010.44.15.png)
\4. 使用SQL语句INSERT向studentsdb数据库的student_info、curriculum、grade表插入数据各表数据如表4-表6所示。 \4. 使用SQL语句INSERT向studentsdb数据库的student_info、curriculum、grade表插入数据各表数据如表4-表6所示。
@ -100,7 +100,7 @@ values('0001','张青平','男','2000-10-01','衡阳市东风路77号'),
('0008','张玲珑','女','1997-12-24','滨江市新建路97号'); ('0008','张玲珑','女','1997-12-24','滨江市新建路97号');
``` ```
![截屏2022-09-23 10.44.41](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/%E6%88%AA%E5%B1%8F2022-09-23%2010.44.41.png) ![截屏2022-09-23 10.44.41](https://lsky.hhdxw.top/imghub/img/%E6%88%AA%E5%B1%8F2022-09-23%2010.44.41.png)
表5 curriculum表的数据 表5 curriculum表的数据
@ -121,7 +121,7 @@ values('0001','计算机应用基础',2),
('0005','高等数学',4); ('0005','高等数学',4);
``` ```
![截屏2022-09-23 10.45.30](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/%E6%88%AA%E5%B1%8F2022-09-23%2010.45.30.png) ![截屏2022-09-23 10.45.30](https://lsky.hhdxw.top/imghub/img/%E6%88%AA%E5%B1%8F2022-09-23%2010.45.30.png)
表6 grade表的数据 表6 grade表的数据
@ -162,7 +162,7 @@ values('0001','0001',80),
('0003','0005',75); ('0003','0005',75);
``` ```
![image-20220923100729127](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/202209231007173.png) ![image-20220923100729127](https://lsky.hhdxw.top/imghub/img/202209231007173.png)
\5. 使用SQL语句ALTER TABLE修改curriculum表的“课程名称”列使之为空。 \5. 使用SQL语句ALTER TABLE修改curriculum表的“课程名称”列使之为空。
@ -170,7 +170,7 @@ values('0001','0001',80),
alter table curriculum modify 课程名称 varchar(50) not null; alter table curriculum modify 课程名称 varchar(50) not null;
``` ```
![image-20220923104648161](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220923104648161.png) ![image-20220923104648161](https://lsky.hhdxw.top/imghub/img/image-20220923104648161.png)
\6. 使用SQL语句ALTER TABLE修改grade表的“分数”列使其数据类型为decimal(5,2)。 \6. 使用SQL语句ALTER TABLE修改grade表的“分数”列使其数据类型为decimal(5,2)。
@ -178,7 +178,7 @@ alter table curriculum modify 课程名称 varchar(50) not null;
alter table grade modify 分数 decimal(5,2); alter table grade modify 分数 decimal(5,2);
``` ```
![image-20220923104705660](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220923104705660.png) ![image-20220923104705660](https://lsky.hhdxw.top/imghub/img/image-20220923104705660.png)
\7. 使用SQL语句ALTER TABLE为student_info表添加一个名为“备注”的数据列其数据类型为varchar(50)。 \7. 使用SQL语句ALTER TABLE为student_info表添加一个名为“备注”的数据列其数据类型为varchar(50)。
@ -186,7 +186,7 @@ alter table grade modify 分数 decimal(5,2);
alter table student_info add 备注 varchar(50); alter table student_info add 备注 varchar(50);
``` ```
![image-20220923104721475](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220923104721475.png) ![image-20220923104721475](https://lsky.hhdxw.top/imghub/img/image-20220923104721475.png)
\8. 使用SQL语句创建数据库studb并在此数据库下创建表stu表结构与数据与studentsdb的student_info表相同。 \8. 使用SQL语句创建数据库studb并在此数据库下创建表stu表结构与数据与studentsdb的student_info表相同。
@ -196,7 +196,7 @@ use studb;
create table stu as select * from studentsdb.student_info; create table stu as select * from studentsdb.student_info;
``` ```
![image-20220923104800750](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220923104800750.png) ![image-20220923104800750](https://lsky.hhdxw.top/imghub/img/image-20220923104800750.png)
\9. 使用SQL语句删除表stu中学号为0004的记录。 \9. 使用SQL语句删除表stu中学号为0004的记录。
@ -204,7 +204,7 @@ create table stu as select * from studentsdb.student_info;
delete from stu where 学号 = '0004'; delete from stu where 学号 = '0004';
``` ```
![image-20220923104823284](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220923104823284.png) ![image-20220923104823284](https://lsky.hhdxw.top/imghub/img/image-20220923104823284.png)
10.使用SQL语句更新表stud中学号为0002的家庭住址为“滨江市新建路96号”。 10.使用SQL语句更新表stud中学号为0002的家庭住址为“滨江市新建路96号”。
@ -212,7 +212,7 @@ delete from stu where 学号 = '0004';
update stu set 家庭住址 = '滨江市新建路96号' where 学号 = '0002' ; update stu set 家庭住址 = '滨江市新建路96号' where 学号 = '0002' ;
``` ```
![image-20220923104902292](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220923104902292.png) ![image-20220923104902292](https://lsky.hhdxw.top/imghub/img/image-20220923104902292.png)
11.删除表stud的“备注”列。 11.删除表stud的“备注”列。
@ -220,7 +220,7 @@ update stu set 家庭住址 = '滨江市新建路96号' where 学号 = '0002' ;
alter table stu drop column 备注; alter table stu drop column 备注;
``` ```
![image-20220923104914868](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20220923104914868.png) ![image-20220923104914868](https://lsky.hhdxw.top/imghub/img/image-20220923104914868.png)
**二、实验思考** **二、实验思考**

View File

@ -59,7 +59,7 @@ CSRFCross-Site Request Forgery为跨站请求伪造它是一种针对Web应
## 5.渗透测试流程 ## 5.渗透测试流程
![image-20230405113706152](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20230405113706152.png) ![image-20230405113706152](https://lsky.hhdxw.top/imghub/img/image-20230405113706152.png)
### 1.明确目标 ### 1.明确目标

View File

@ -40,7 +40,7 @@
### 2.功能测试 ### 2.功能测试
![image-20230415215051344](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20230415215051344.png) ![image-20230415215051344](https://lsky.hhdxw.top/imghub/img/image-20230415215051344.png)
#### 1.切换测试 #### 1.切换测试
@ -128,7 +128,7 @@
## 4.移动app测试流程 ## 4.移动app测试流程
![image-20230415214818612](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20230415214818612.png) ![image-20230415214818612](https://lsky.hhdxw.top/imghub/img/image-20230415214818612.png)
● 接受测试版本:由开发人员提交给测试人员。 ● 接受测试版本:由开发人员提交给测试人员。
● App版本测试主要检查测试App开发阶段对应的版本是否一致。 ● App版本测试主要检查测试App开发阶段对应的版本是否一致。

View File

@ -18,7 +18,7 @@
## 2.自动化测试的基本流程 ## 2.自动化测试的基本流程
![image-20230407182936730](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20230407182936730.png) ![image-20230407182936730](https://lsky.hhdxw.top/imghub/img/image-20230407182936730.png)
### 1.制定测试计划 ### 1.制定测试计划
@ -52,7 +52,7 @@
自动化测试采用金字塔策略 自动化测试采用金字塔策略
![image-20230407183326710](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20230407183326710.png) ![image-20230407183326710](https://lsky.hhdxw.top/imghub/img/image-20230407183326710.png)
金字塔要求自动化测试从三个不同级别进行最底部的单元测试占据了自动化测试的最大百分比其次是接口测试和UI测试。将自动化测试重点工作放在单元测试和接口测试阶段有助于加快项目整体开发进度减少后期开发和测试的成本。 金字塔要求自动化测试从三个不同级别进行最底部的单元测试占据了自动化测试的最大百分比其次是接口测试和UI测试。将自动化测试重点工作放在单元测试和接口测试阶段有助于加快项目整体开发进度减少后期开发和测试的成本。
@ -153,7 +153,7 @@ UFT是商业的软件自动化测试和回归测试工具其前身是QTPQu
与传统集成不同,在持续集成中,开发人员会频繁地向主干提交代码,这些新提交的代码首先经过编译和自动化测试验证,然后合并到主干。 与传统集成不同,在持续集成中,开发人员会频繁地向主干提交代码,这些新提交的代码首先经过编译和自动化测试验证,然后合并到主干。
![image-20230407192239455](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20230407192239455.png) ![image-20230407192239455](https://lsky.hhdxw.top/imghub/img/image-20230407192239455.png)
## 8.持续集成过程 ## 8.持续集成过程
@ -163,7 +163,7 @@ CI是在源代码变更后自动检测、拉取、构建以及进行单元测试
### 1.传统持续集成框架测试 ### 1.传统持续集成框架测试
![image-20230407192400492](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20230407192400492.png) ![image-20230407192400492](https://lsky.hhdxw.top/imghub/img/image-20230407192400492.png)
在传统持续集成框架中,最核心的部分是通过集成工具实现自动化测试的调度管理。在启动测试之前,测试所需要的数据、测试用例、测试框架已经搭建完毕,并且项目通过编译,若测试项目使用服务器和数据库,这些资源也需要配备完成。 在传统持续集成框架中,最核心的部分是通过集成工具实现自动化测试的调度管理。在启动测试之前,测试所需要的数据、测试用例、测试框架已经搭建完毕,并且项目通过编译,若测试项目使用服务器和数据库,这些资源也需要配备完成。
@ -173,6 +173,6 @@ CI是在源代码变更后自动检测、拉取、构建以及进行单元测试
使用Docker容器搭建持续集成测试环境框架。 使用Docker容器搭建持续集成测试环境框架。
![image-20230407192414139](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20230407192414139.png) ![image-20230407192414139](https://lsky.hhdxw.top/imghub/img/image-20230407192414139.png)
使用容器技术进行测试方便应用的部署以及不同场景下的测试,即一次构建随处运行。此外,容器技术在提高测试效率的同时降低了企业项目花费的成本、加快了开发速度。 使用容器技术进行测试方便应用的部署以及不同场景下的测试,即一次构建随处运行。此外,容器技术在提高测试效率的同时降低了企业项目花费的成本、加快了开发速度。

View File

@ -14,7 +14,7 @@
#### (2)快速原型模型: #### (2)快速原型模型:
![image-20230330215605992](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20230330215605992.png) ![image-20230330215605992](https://lsky.hhdxw.top/imghub/img/image-20230330215605992.png)
优点:克服了需求不明确带来的风险,适用于不能预先确定需求的软件项目。 优点:克服了需求不明确带来的风险,适用于不能预先确定需求的软件项目。
@ -22,7 +22,7 @@
#### (3)迭代模型 #### (3)迭代模型
![image-20230330215707838](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20230330215707838.png) ![image-20230330215707838](https://lsky.hhdxw.top/imghub/img/image-20230330215707838.png)
优点:适应客户需求变更;降低了开发成本和风险。 优点:适应客户需求变更;降低了开发成本和风险。
@ -30,7 +30,7 @@
#### (4)螺旋模型 #### (4)螺旋模型
![image-20230330215750504](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20230330215750504.png) ![image-20230330215750504](https://lsky.hhdxw.top/imghub/img/image-20230330215750504.png)
螺旋模型包含四个象限: 螺旋模型包含四个象限:
@ -76,13 +76,13 @@
(3)满足用户隐式需求:除了满足用户的显式需求,软件产品如果满足用户的隐式需求,即潜在的可能需要在将来开发的功能,将会极大地提升用户满意度,这就意味着软件质量更高。 (3)满足用户隐式需求:除了满足用户的显式需求,软件产品如果满足用户的隐式需求,即潜在的可能需要在将来开发的功能,将会极大地提升用户满意度,这就意味着软件质量更高。
![image-20230330215451108](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20230330215451108.png) ![image-20230330215451108](https://lsky.hhdxw.top/imghub/img/image-20230330215451108.png)
影响软件质量的因素包括:需求分析、设计、编码、集成、部署、测试、维护等。 影响软件质量的因素包括:需求分析、设计、编码、集成、部署、测试、维护等。
## 4.产生软件缺陷的原因及软件处理流程 ## 4.产生软件缺陷的原因及软件处理流程
![image-20230330215332051](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20230330215332051.png) ![image-20230330215332051](https://lsky.hhdxw.top/imghub/img/image-20230330215332051.png)
#### 原因: #### 原因:
@ -102,7 +102,7 @@
每个公司的软件缺陷处理流程不尽相同,但是它们遵循的最基本流程是一样的,都要经过提交、分配、确认、处理、复测、关闭等环节。 每个公司的软件缺陷处理流程不尽相同,但是它们遵循的最基本流程是一样的,都要经过提交、分配、确认、处理、复测、关闭等环节。
![image-20230330215309390](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20230330215309390.png) ![image-20230330215309390](https://lsky.hhdxw.top/imghub/img/image-20230330215309390.png)
● 提交:测试人员发现缺陷之后,将缺陷提交给测试组长。 ● 提交:测试人员发现缺陷之后,将缺陷提交给测试组长。
@ -156,13 +156,13 @@
把软件(程序)当作一个有输入与输出的黑匣子,它把程序当作一个输入域到输出域的映射,只要输入的数据能输出预期的结果即可,不必关心程序内部是怎么样实现的。 把软件(程序)当作一个有输入与输出的黑匣子,它把程序当作一个输入域到输出域的映射,只要输入的数据能输出预期的结果即可,不必关心程序内部是怎么样实现的。
![image-20230330214805164](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20230330214805164.png) ![image-20230330214805164](https://lsky.hhdxw.top/imghub/img/image-20230330214805164.png)
2.白盒测试 2.白盒测试
测试人员了解软件程序的逻辑结构、路径与运行过程,在测试时,按照程序的执行路径得出结果。白盒测试就是把软件(程序)当作一个透明的盒子,测试人员清楚的知道从输入到输出的每一步过程。 测试人员了解软件程序的逻辑结构、路径与运行过程,在测试时,按照程序的执行路径得出结果。白盒测试就是把软件(程序)当作一个透明的盒子,测试人员清楚的知道从输入到输出的每一步过程。
![image-20230330214815904](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20230330214815904.png) ![image-20230330214815904](https://lsky.hhdxw.top/imghub/img/image-20230330214815904.png)
总结:相对于黑盒测试来说,白盒测试对测试人员的要求会更高一点,它要求测试人员具有一定的编程能力,而且要熟悉各种脚本语言。但是在软件公司里,黑盒测试与白盒测试并不是界限分明的,在测试一款软件时往往是黑盒测试与白盒测试相结合对软件进行完整全面的测试。 总结:相对于黑盒测试来说,白盒测试对测试人员的要求会更高一点,它要求测试人员具有一定的编程能力,而且要熟悉各种脚本语言。但是在软件公司里,黑盒测试与白盒测试并不是界限分明的,在测试一款软件时往往是黑盒测试与白盒测试相结合对软件进行完整全面的测试。
@ -232,7 +232,7 @@
● 测试阶段:实施测试并提交相应的测试报告。 ● 测试阶段:实施测试并提交相应的测试报告。
![image-20230330215010391](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20230330215010391.png) ![image-20230330215010391](https://lsky.hhdxw.top/imghub/img/image-20230330215010391.png)
## 7.常见的软件测试模型 ## 7.常见的软件测试模型
@ -240,23 +240,23 @@
V模型是一种水平型的软件测试模型它把软件开发过程分为验收测试和系统测试两个阶段每一阶段由一组测试活动构成它们是相互联系的。V模型的优点在于及时发现缺陷减少重复测试减少发现缺陷所需要的时间有效控制质量提高效率为软件开发提供可操作性的测试规范。 V模型是一种水平型的软件测试模型它把软件开发过程分为验收测试和系统测试两个阶段每一阶段由一组测试活动构成它们是相互联系的。V模型的优点在于及时发现缺陷减少重复测试减少发现缺陷所需要的时间有效控制质量提高效率为软件开发提供可操作性的测试规范。
![image-20230330215022643](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20230330215022643.png) ![image-20230330215022643](https://lsky.hhdxw.top/imghub/img/image-20230330215022643.png)
#### (2)W模型 #### (2)W模型
![image-20230330215056308](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20230330215056308.png) ![image-20230330215056308](https://lsky.hhdxw.top/imghub/img/image-20230330215056308.png)
W模型是一种垂直型的软件测试模型它在V模型的基础上扩展出来的它的特点是把软件开发过程分为8个部分每个部分都有一组测试活动。W模型的优点在于它能够更好地控制软件的质量更加注重从需求分析到实施的整个软件开发过程充分发挥测试人员的技术知识提高测试效率。 W模型是一种垂直型的软件测试模型它在V模型的基础上扩展出来的它的特点是把软件开发过程分为8个部分每个部分都有一组测试活动。W模型的优点在于它能够更好地控制软件的质量更加注重从需求分析到实施的整个软件开发过程充分发挥测试人员的技术知识提高测试效率。
#### (3)H模型 #### (3)H模型
![image-20230330215100820](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20230330215100820.png) ![image-20230330215100820](https://lsky.hhdxw.top/imghub/img/image-20230330215100820.png)
H模型是一种水平型的软件测试模型它是V模型的升级版。H模型把软件开发过程分为4个部分每个部分都有一组测试活动它们都是相互联系的。H模型的优点在于它能够更好地控制软件的质量更加注重从需求分析到实施的整个软件开发过程充分发挥测试人员的技术知识提高测试效率避免重复测试和发现缺陷所耗费的时间。 H模型是一种水平型的软件测试模型它是V模型的升级版。H模型把软件开发过程分为4个部分每个部分都有一组测试活动它们都是相互联系的。H模型的优点在于它能够更好地控制软件的质量更加注重从需求分析到实施的整个软件开发过程充分发挥测试人员的技术知识提高测试效率避免重复测试和发现缺陷所耗费的时间。
#### (4)X模型 #### (4)X模型
![image-20230330215106457](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20230330215106457.png) ![image-20230330215106457](https://lsky.hhdxw.top/imghub/img/image-20230330215106457.png)
X模型是一种通过把软件开发过程分为多个交叉部分每个部分都有一组测试活动的模型。X模型的优点在于它可以更好地控制软件的质量从需求分析到实施的整个软件开发过程都可以发挥测试人员的技术知识提高测试效率减少重复测试和发现缺陷所耗费的时间。 X模型是一种通过把软件开发过程分为多个交叉部分每个部分都有一组测试活动的模型。X模型的优点在于它可以更好地控制软件的质量从需求分析到实施的整个软件开发过程都可以发挥测试人员的技术知识提高测试效率减少重复测试和发现缺陷所耗费的时间。

View File

@ -97,7 +97,7 @@ TPS是指系统每秒钟能够处理的事务和交易的数量它是衡量
## 4.性能测试流程 ## 4.性能测试流程
![image-20230405113002317](https://yovinchen-1308133012.cos.ap-beijing.myqcloud.com/image-20230405113002317.png) ![image-20230405113002317](https://lsky.hhdxw.top/imghub/img/image-20230405113002317.png)
### 1.分析性能测试需求 ### 1.分析性能测试需求