Checking if record already exists
Hi all,
I'm trying to see what is the best way to check if a record already exists in the DB, specifically in a relationship table.
I have 3 tables: manager, employess, managers_employess_relationship
each manager can have multiple employees.
Manager table :
ID Name
1 Juan
Employees Table
ID Name
4 Liza
5 Emily
managers_employess_relationship table ( has the foreign keys from both tables)
ID Manager_Id Employee_Id
1 1 4
2 1 5
when a manager is adding its employees in a form what is the best way to check if its adding an already assigned employee, for example if manager juan tried to add Liza again, I want to make sure it gives him some type of validation saying that liza is already assigned to him. to avoid having duplicates in the managers_employess_relationship table.
what do you all recommend?
thanks in advance
