This commit is contained in:
2021-05-08 11:03:38 +08:00
parent 81b0b554dd
commit 3834fc02dc
11 changed files with 87 additions and 21 deletions

View File

@@ -3,6 +3,7 @@ module.exports = {
description: '测试',
themeConfig: {
search:false,
sidebarDepth:2,
sidebar: 'auto',
nav: [
@@ -14,7 +15,8 @@ module.exports = {
'install', /* /foo/one.html */
'create', /* /foo/two.html */
'insert',
'update'
'update',
'delete'
] ,
'/': [
'', /* / */

View File

@@ -1,16 +1 @@
---
home: true
heroImage: /hero.png
heroText: Hero 标题
tagline: Hero 副标题
actionText: 快速上手 →
actionLink: /zh/guide/
features:
- title: 简洁至上
details: 以 Markdown 为中心的项目结构,以最少的配置帮助你专注于写作。
- title: Vue驱动
details: 享受 Vue + webpack 的开发体验,在 Markdown 中使用 Vue 组件,同时可以使用 Vue 来开发自定义主题。
- title: 高性能
details: VuePress 为每个页面预渲染生成静态的 HTML同时在页面被加载的时候将作为 SPA 运行。
footer: MIT Licensed | Copyright © 2018-present Evan You
---
# 测试课程教案

49
docs/mysql/delete.md Normal file
View File

@@ -0,0 +1,49 @@
# 删除数据
> mysql删除是使用delete语句
## delete
删除语法其实是非常简单的,但是也是比较危险的,需要慎重操作。
```sql
delete from table [where ];
```
最简单的删除语句是
```sql
delete from tablename;
```
但是不要这么操作,他会像修改时候一样,全部删除掉,所以操作删除的时候一定要添加条件
```sql
delete from tablename where ;
```
还是之前的class表。
![图 1](../../images/c486c8a54c50d5f9eb96c1e14ba76b5b069fe4055c8eb57f0a5c2d9a945639bc.png)
比如我要删除姓名为张三的人,应该怎么删除呢?
```sql
delete from class where name = "张三";
```
![图 2](../../images/60aac5dbd2c221fcb19925284ebd621b59a08ac3d88115a8572a294483e85992.png)
删除成功了,然后查询之后张三就没有了。
比如要删除年龄是18的人那么应该就是 `where age = 18`
```sql
delete from class where age = 18;
```
![图 3](../../images/78eb44abb4fa3770f2ca3f9f064f8e6846e3b21f28044ce872f880346d438776.png)
成功删除了删除了所有年龄是18的人。
删除是比较简单的操作,接下来就要来看一下主键。

17
docs/mysql/primaryKey.md Normal file
View File

@@ -0,0 +1,17 @@
# 主键
> 在之前的操作中我们进行了增删改查,并没有出现什么问题,但是有一个很大的问题,前面的姓名。年龄,性别都是有可能重复的,我们没有办法准确的确定到一个人,比如下面这种情况。
## primary key
先看一下现在表中的数据。
![图 4](../../images/4874f36184f21487e8bf5a353f8c9416d2db19b3f37dc98ab1687afceac80ac3.png)
现在表中还有李四和小名这两个人但是这个班级中又来了一个转校生名字也叫李四性别也是男但是年龄是21。
先添加这么一个人
```sql
insert into class(name,sex,age) value("李四","",21);
```

View File

@@ -1,8 +1,8 @@
# 数据操作
# 修改数据
> 之前已经看到了查询数据与添加数据,下面来看一下修改数据
## 修改数据
## update
修改数据也有自己的另一个语法。
@@ -80,7 +80,7 @@ set 后面跟上修改的字段名=值,然后用逗号隔开 `,`
update class set sex="",age=10 where name="李四";
```
执行一下
执行一下
![图 15](../../images/bb17eb99a1330e324b3e220d2128ec8c0a354311bc573b25207125e79b73b27f.png)

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

View File

@@ -10,4 +10,4 @@
"dev": "vuepress dev docs",
"build": "vuepress build docs"
}
}
}

View File

@@ -3631,6 +3631,11 @@ glob-to-regexp@^0.3.0:
resolved "https://registry.yarnpkg.com/glob-to-regexp/-/glob-to-regexp-0.3.0.tgz#8c5a1494d2066c570cc3bfe4496175acc4d502ab"
integrity sha1-jFoUlNIGbFcMw7/kSWF1rMTVAqs=
glob-to-regexp@^0.4.1:
version "0.4.1"
resolved "https://registry.npm.taobao.org/glob-to-regexp/download/glob-to-regexp-0.4.1.tgz#c75297087c851b9a578bd217dd59a92f59fe546e"
integrity sha1-x1KXCHyFG5pXi9IX3VmpL1n+VG4=
glob@^7.0.3, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4, glob@^7.1.6:
version "7.1.6"
resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6"
@@ -7651,6 +7656,14 @@ watchpack@^1.7.4:
chokidar "^3.4.1"
watchpack-chokidar2 "^2.0.1"
watchpack@^2.1.1:
version "2.1.1"
resolved "https://registry.nlark.com/watchpack/download/watchpack-2.1.1.tgz#e99630550fca07df9f90a06056987baa40a689c7"
integrity sha1-6ZYwVQ/KB9+fkKBgVph7qkCmicc=
dependencies:
glob-to-regexp "^0.4.1"
graceful-fs "^4.1.2"
wbuf@^1.1.0, wbuf@^1.7.3:
version "1.7.3"
resolved "https://registry.yarnpkg.com/wbuf/-/wbuf-1.7.3.tgz#c1d8d149316d3ea852848895cb6a0bfe887b87df"