I have a created a table 'data' with two columns: id, name.
+-------+---------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------+---------------+------+-----+---------+----------------+
| id | int(11) | | PRI | NULL | auto_increment |
| name | varchar(50) | | PRI | | |
+-------+---------------+------+-----+---------+----------------+
As you can see above, id is set as 'auto_increment' so MySQL requires
it to be primary key. I want to avoid same name again so I made the
second column 'name' to be primary key as well.
When I insert a name in the table, say 'John', I can do that with the
SQL statement - INSERT INTO data values ('',"John");. If I want to
insert the same name again, MySQL lets me do that so now I have two
entries for 'John' (that I do not want). Can you help me how I can
avoid this.
Pir.