-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
“PHZ”
committed
Oct 5, 2024
1 parent
5da3ac0
commit 6fb05a6
Showing
1 changed file
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
--- | ||
title: 数据库(2) | ||
date: 2024-10-05 21:33:44 | ||
tags: | ||
- 学习笔记 | ||
--- | ||
#### DML语句 | ||
DML(Data Manipulation Language)(数据库操作语言),用于对数据库中的数据记录进行增删改操作 | ||
- 添加数据(INSERT) 在table中添加一条数据 | ||
- 修改数据(UPDATE) 对table中的数据进行修改 | ||
- 删除数据(DELETE) 对table中选定的数据进行删除 | ||
##### DML-添加数据 | ||
1. 给指定字段添加数据 | ||
``` INSERT INTO 表名(字段名1,字段名2,...) VALUES(值1, 值2, ...);``` | ||
|
||
2. 给全部字段添加数据 | ||
``` INSERT INTO 表名 VALUES(值1, 值2, ...); ``` | ||
|
||
3. 批量添加数据 | ||
``` INSERT INTO 表名(字段1, 字段2, ...) VALUES(值1, 值2, ...), (值1, 值2, ...),...,(值1, 值2, ...); ``` | ||
``` INSERT INTO 表名 VALUES(值1, 值2, ...), (值1, 值2, ...),...,(值1, 值2, ...); ``` | ||
|
||
##### DML-修改数据 | ||
``` UPDATE 修改数据 SET 字段名1 = 值1 字段名2 = 值2, ... [WHERE 条件]; ``` | ||
> **注意:**修改语句的条件可以有,也可以没有,如果没有条件,则会修改整张表。 | ||
##### DML-删除数据 | ||
``` DELETE FROM 表名 [WHERE 条件] ``` | ||
|
||
> **注意:** | ||
> - DELETE语句的条件可以有,也可以没有,如果没有条件,则会删除整张数据表 | ||
> - DELETE语句不能删除某一个字段的值(可以使用UPDATE) | ||
#### DQL语句 | ||
DQL英文全称是Data Query Language(数据查询语言),数据查询语言,用来查询数据库中表的记录。 | ||
查询关键字: ==SELECT== | ||
|
||
|
||
|