I am making an application wich insert users into a mysql Database.
i know you can make a field value unique, but i want a combination of 2 collums in a record to be unique.
id, firstname, lastname, creationdate
1, John, Doe, (today)
now what i want to archieve is that i can enter a record like :
2, John, Deo, (today)
but i cannot enter:
2, John, Doe, (today)
with wat sql querry can i make an combined unique value
use the below query
ALTER TABLE Persons ADD CONSTRAINT pk_PersonID PRIMARY KEY (FirstName,LastName)