当前位置:网站首页>MySQL learning summary 8: addition, deletion and modification of data processing
MySQL learning summary 8: addition, deletion and modification of data processing
2022-06-13 03:23:00 【koping_ wu】
Mysql *** : Addition, deletion and modification of data processing
1、 insert data
1.1 Insert the way 1:VALUES The way
situation 1: Insert data for the specified fields of the table
INSERT INTO Table name (column1 [, column2, ..., columnn])
VALUES (value1 [,value2, ..., valuen]);
situation 2: Insert multiple records at the same time
INSERT INTO table_name(column1 [, column2, ..., columnn])
VALUES
(value1 [,value2, ..., valuen]),
(value1 [,value2, ..., valuen]),
......
(value1 [,value2, ..., valuen]);
A that inserts multiple rows of records at the same time INSERT Statement is equivalent to multiple single line inserts INSERT sentence , But multi line INSERT Statement during processing More efficient . because MySQL Execute a single article INSERT Statement inserts more rows of data than using multiple INSERT Fast sentence , Therefore, when inserting multiple records, it is best to choose to use a single record INSERT Insert... In the form of a statement .
1.1 Insert the way 2: Insert the query results into the table
INSERT Can also be SELECT Insert the result of the statement query into the table , At this time, it is not necessary to input the values of each record one by one , Just use one INSERT Statement and a line SELECT Statements can quickly insert multiple rows from one or more tables into a table .
The basic syntax is as follows :
INSERT INTO Target table name
(tar_column1 [, tar_column2, ..., tar_columnn])
SELECT
(src_column1 [, src_column2, ..., src_columnn])
FROM Source table name
[WHERE condition]
2、 Update data
The syntax of the update statement is as follows :
UPDATE table_name
SET column1=value1, column2=value2, ... , column=valuen
[WHERE condition]
Take a chestnut : take id by 113 The employee's department is changed to 70.
UPDATE employees
SET department_id = 70
WHERE employee_id = 113;
3、 Delete data
The syntax for deleting data is as follows :
DELETE FROM table_name [WHERE <condition>];
for instance : Delete departments The Department name in the table is ’Finance’ All the information about .
DELETE FROM departments
WHERE
department_name = 'Finance';
边栏推荐
- Review notes of RS data communication foundation STP
- 关于复合函数的极限问题
- MySQL imports and exports multiple libraries at one time
- Brew tool - "fatal: could not resolve head to a revision" error resolution
- 2-year experience summary to tell you how to do a good job in project management
- Neo4j auradb free, the world's leading map database
- Implode and explode in golang
- Unified scheduling and management of dataX tasks through web ETL
- C # simple understanding - method overloading and rewriting
- KITTI数据集无法下载的解决方法
猜你喜欢
Vs Code modify default terminal_ Modify the default terminal opened by vs Code
Use cypher to get the tree of the specified structure
The most complete ongdb and neo4j resource portal in history
Neil eifrem, CEO of neo4j, interprets the chart data platform and leads the development of database in the next decade
Quickly obtain the attributes of the sub graph root node
Querywrapper constructor method
Wechat applet switch style rewriting
Summary of rust language practice
C simple understanding - arrays and sets
开源-校园论坛和资源共享小程序
随机推荐
P1048 [noip2005 popularization group] Drug collection
Aggregation analysis of research word association based on graph data
Several functions in YAF framework controller
Vs Code modify default terminal_ Modify the default terminal opened by vs Code
How to Draw Useful Technical Architecture Diagrams
C method parameter: out
C method parameter: ref
【 enregistrement pytorch】 paramètre et tampon des variables pytorch. Self. Register Buffer (), self. Register Paramètre ()
Wechat applet coordinate location interface usage (II) map interface
Qt之QTreeView的简单使用(含源码+注释)
技术博客,经验分享宝典
Detailed explanation of curl command
Using linked list to find set union
MMAP usage in golang
Azure SQL db/dw series (12) -- using query store (1) -- report Introduction (1)
brew工具-“fatal: Could not resolve HEAD to a revision”错误解决
Redis server configuration
Delete the number of a range in the linked list
MySQL index bottom layer (I)
JVM JMM (VI)