How do I make it so 2 columns cannot have the same data. My table consists of 3 fields.
studentid id_project level_of_want
1 2 high
1 3 low
1 4 high
1 2 low
I want is so that one column can have the same data (eg 1 in studentid) but the studentid and id_project cannot have the same data more than once (enties 1 and 4 above). studentid can be 1 and id_project can be 1, but this can only happen once.
You need to add an “unique” index.
Read http://dev.mysql.com/doc/refman/5.0/en/create-index.html