Determine whether a record already exists before inserting a SQL statementINSERT INTO test(A,B) select 'ab',2 WHERE NOT EXISTS (SELECT * FROM test WHERE A='ab'); Simple collection of judgments when inserting sqlWhen the user module or other modules require database uniqueness, you need to first determine whether the data already exists in the database before inserting it; This is the most basic SQL insert statement. ```sql ```sql INSERT INTO user(name,password) values(admin,123456) Next, transform it into inserting to determine whether #{parameter} exists ```sql INSERT INTO user(name, password) SELECT #{admin},#{123456} FROM DUAL WHERE NOT EXISTS (SELECT name,password FROM user WHERE name= #{admin} and password= # {123456}); `` This is done, the query return value = 0 means failure = 1 means success The above is my personal experience. I hope it can give you a reference. I also hope that you will support 123WORDPRESS.COM. You may also be interested in:
|
<<: The most comprehensive collection of front-end interview questions
>>: How to draw a vertical line between two div tags in HTML
Currently encountering such a problem My situatio...
Table of contents Preface What is Hot Change Coco...
This article uses examples to describe advanced u...
Some people use these three tags in a perverted wa...
This article shares the shell script of mysql5.6....
1. SSH remote management SSH is a secure channel ...
1. Environmental Preparation CentOS Linux release...
Table of contents Preface Computed properties Int...
Introduction Use simple jQuery+CSS to create a cus...
How to modify the style of the el-select componen...
Introduction Incremental backup means that after ...
This article example shares the specific code of ...
Just add the following code to achieve it. Method ...
Table of contents 1 Node.js method of sending ema...