A record exists or not is always be a question for developers, Some of the tables like user registration or other tables, we don’t want to insert any duplicate value. First, we have to check the record is exists or not.
We always want to insert a is unique value into the table.
In this blog i will explain you, how can you check already exist record in table.
It’s very easy to check existing record in table.
Below code will help you to check record exist or not.
If EXISTS ( SELECT group_name FROM demo WHERE id= ” id”)
BEGIN SELECT 'Record EXIST'" END ELSE BEGIN INSERT INTO demo (name,address) values('abc','xyz') END
Here the table name is demo and there is three fields id,name and address.
This code will help you to restrict duplicate value in table.
I hope this blog is helpful for you, If you like this blog and helpful for you, then don’t forget to share it, This can help others who are facing the problem like this.