It is great to see ChatGPT providing some real help! My 25 years of experience do scream though when I see this kind of setup. The better practice is to handle this kind of the constraint on the application level as opposed to relying on database