I see that I can “Delete” a record that doesn’t exist with impunity; but are there any hidden dangers in this?
If it would be better to first check to see if the record exists, is there some ultra-fast way to do that?
IOW, is there a way to quickly perform this pseudo-SQL:
if recordExists(table, rowval[s])
deleteRecord
?
In general, there’s no real reason to check if something exists before you delete it. SQL is a set-based language, it’s perfectly valid to delete the elements of an empty set
To check if something exists requires a look-up and, at worst, you’ll have to do the same lookup again to delete. The only time that this is good form is when it’s possible for the statement to cause an error if the condition isn’t met (statements that modify the DDL come to mind)