Your suggestion is good but I have seen many sharing database programs made in SQL in many offices in which for example if you are going to make a bill then in that program the bill number is shown first and after that other data entry is feed.
Suppose at some time, for example, a user creates a bill of number 202 and at the same time on this program (which is shared on another computer) another user also creates a bill of number 202, then now the user who saved first When the user clicks on the button, his data will be saved and the user who later clicks on the save button will be shown an error message.
"this bill no. already exists"