"Find-or-insert" using a single query
Consider the task: you need to read a row, and if it doesn't exist, insert it (and read what's just inserted). Using a single query.
Consider the task: you need to read a row, and if it doesn't exist, insert it (and read what's just inserted). Using a single query.
There are various approaches to formatting SQL. There are two major ones: