[MySQL] Insert if the data does not exist

series of articles

C# underlying library-MySQLBuilder script construction class (select, insert, update, in, automatic generation of SQL with conditions)
link to this article: https://blog.csdn.net/youcheng_ge/article/details/129179216

C# underlying library – MySQL database operation auxiliary class (recommended reading)
link to this article: https://blog.csdn.net/youcheng_ge/article/details/126886379

C# underlying library – the use of SQLite (small, local database)
link to this article: https://blog.csdn.net/youcheng_ge/article/details/123666958

[Improve programming efficiency] Import Excel data into the database in batches
Link to this article: https://blog.csdn.net/youcheng_ge/article/details/126427323

[Oracle] The database server restricts ip access to
this article link: https://blog.csdn.net/youcheng_ge/article/details/122220930

[Oracle] Excel Import Data Tutorial
Link to this article: https://blog.csdn.net/youcheng_ge/article/details/118722756

[Oracle] Database Restore Tutorial_Data Pump
Link to this article: https://blog.csdn.net/youcheng_ge/article/details/118054855

[SQL] How to query table fields and identify primary keys
Link to this article: https://blog.csdn.net/youcheng_ge/article/details/110820405

[SQL] Usage of outer apply
Link to this article: https://blog.csdn.net/youcheng_ge/article/details/79903489

[SQL] Multi-table connection duplicate data processing
Link to this article: https://blog.csdn.net/youcheng_ge/article/details/79903619

MySQL installation tutorial (detailed)
link to this article: https://blog.csdn.net/youcheng_ge/article/details/126037520

MySQL uninstall tutorial (detailed)
link to this article: https://blog.csdn.net/youcheng_ge/article/details/129279265

[MySQL] How to add the "total" field for group by classification and summary?
Link to this article: https://blog.csdn.net/youcheng_ge/article/details/128217837

[MySQL] Usage of WITH CHECK OPTION
Link to this article: https://blog.csdn.net/youcheng_ge/article/details/128147196

[MySQL] How to improve efficiency by using stored procedures to insert tens of millions of data?
Link to this article: https://blog.csdn.net/youcheng_ge/article/details/77728189

[MySQL] Realization of row and column transposition of database table
Link to this article: https://blog.csdn.net/youcheng_ge/article/details/77625052

[MySQL] In the query, the NULL value is converted to an empty string
This link: https://blog.csdn.net/youcheng_ge/article/details/130381878


foreword

This column is [Database], which mainly introduces the functions and characteristics of SQL, SQL data definition language (table, view, index, constraint), SQL data operation language (data retrieval, data insertion, data deletion, data update), creation and deletion Triggers, SQL Data Control Language (Security and Authorization, Transaction Processing), and Embedded SQL.
If you are interested in this album, keep paying attention. If you have any questions, you can also give feedback in the comment area and private message me.
insert image description here

1. Technical introduction

2. Test cases

2.1 Data preparation

INSERT INTO dl_mes.模具信息表(状态描述,模具供应商编号,采购订单编号,模具出厂编号,模具出厂规格,模具出厂直径,模具规格,最小直径,最大直径,平均直径,椭圆度,椭圆率,左定径长度,右定径长度,定径长度,有效值,定径区AR,左压缩角,右压缩角,压缩角,压缩区AR1,压缩区AR2,孔偏角X,孔偏角Y,倍率,检验结果,异常类型,行动,特殊检验说明,模具检验时间,模具检验录入时间,模具检验人编号,模具检验备注) SELECT '已经模具检验合格, 等待模具打标','DQ','','D30713001','0.0391mm','0.0391','0.0388mm','0.0387','0.0388','0.0388','0.0001','0.3','46','25','36','30','1.5','5.2','5.2','10.4','5','17','0','0','10X','合格','空','空','','1000/1/1 0:00:00','2023/7/17 15:02:36','刘思思',''
WHERE NOT EXISTS(SELECT * FROM 模具信息表 WHERE 模具出厂编号='D30713001' AND 模具出厂直径='0.0391')
;

3. Usage summary

IF EXISTS
WHERE NOT EXISTS

Guess you like

Origin blog.csdn.net/youcheng_ge/article/details/131767000