Everyone who uses databases is in the habit of using "If exists update else insert" in the software program. Irrespective of the software program (Oracle, Mysql, Sql Server) and irrespective of the language (Php, ASP, Java). Ever wondered what is the efficient way of doing it.
Typically, we do it this way: