w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
MySQL better approach to check duplicate entry

Here are my answers:

  1. Is 2nd approach better for duplicate entry prevention?

    yes, in my opinion second approach is better, if you know that userid is going to be always unique, you should make it a unique field, MySQL will automatically handle it.

  2. Are 2nd & 3rd approach same or different?

    I think both are same and MySQL throws error in these cases.

  3. Is there still any better approach to prevent duplicate entry with minimum DB Query?

    You can put UNIQUE INDEX on this column, that will be faster.





© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.