当前位置:网站首页>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';
边栏推荐
- Differences between XAML and XML
- PHP uses the header function to download files
- Isolation level, unreal read, gap lock, next key lock
- 【同步功能】2.0.16-19 版本都有同步功能修复的更新,但未解决问题
- MASA Auth - SSO与Identity设计
- C language function strcmp() (compare two strings)
- Technical documentbookmark
- Technology blog, a treasure trove of experience sharing
- Reading notes of effective managers
- [JVM Series 7] garbage collector
猜你喜欢

C # simple understanding - method overloading and rewriting

Summary of rust language practice

English语法_方式副词-位置

JVM JMM (VI)

SQL execution process in MySQL (3)

MySQL index bottom layer (I)

Open source - campus forum and resource sharing applet

Aggregation analysis of research word association based on graph data

QML connecting to MySQL database

Use and arrangement of wechat applet coordinate position interface (I)
随机推荐
Several functions in YAF framework controller
Keil removes annoying st link update tips
C simple understanding - generics
MASA Auth - SSO与Identity设计
[JVM series 8] overview of JVM knowledge points
MASA Auth - 从用户的角度看整体设计
[JVM Series 2] runtime data area
Differences between XAML and XML
Azure SQL db/dw series (9) -- re understanding the query store (2) -- working principle
look on? What is the case between neo4j and ongdb?
Wechat applet switch style rewriting
MySQL and PostgreSQL installation subtotal
[JVM series 4] common JVM commands
【 enregistrement pytorch】 paramètre et tampon des variables pytorch. Self. Register Buffer (), self. Register Paramètre ()
How to Draw Useful Technical Architecture Diagrams
Typical application of ACL
C method parameter: in
视频播放屡破1000W+,在快手如何利用二次元打造爆款
Reading notes of effective managers
Use of jstack