How do I add a one-to-one relationship in MYSQL?
- by alex
+-------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+-------------+------+-----+---------+-------+
| pid | varchar(99) | YES | | NULL | |
+-------+-------------+------+-----+---------+-------+
1 row in set (0.00 sec)
+-------+---------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+---------------+------+-----+---------+-------+
| pid | varchar(2000) | YES | | NULL | |
| recid | varchar(2000) | YES | | NULL | |
+-------+---------------+------+-----+---------+-------+
2 rows in set (0.00 sec)
This is my table. pid is just the id of the user. "recid" is a recommended song for that user.
I hope to have a list of pid's, and then recommended songs for each person.
Of course, in my 2nd table, (pid, recid) would be unique key.
How do I do a one-to-one query for this ?