I need to perform a Insert in the database if there is no person's cpf. if it exists it has to do a Update . But all this through a single script in MySql . I have illustrated the example below as I am doing today:
1 If the cpf of the entity (not the primary code) does not exist, then I need to execute according to the SQL below:
insert into entidade (cpf, nome, email) values (11111111111, 'robson', 'email')
2 If the CPF exists, then I will just update the data, according to the SQL below:
update entidade set nome = 'robson', email = 'email' where cpf = 11111111111
Is it possible that this is a single SQL?