I have a table contains columns like:
time tv_program user_name
xxx friends John
xxx Game of Thrones Kate
...
...
Now I want to create separate index table for tv_program and user_name like:
id tv_program
1 friends
2 Game of Thrones
3 ...
4 ...
id user_name
1 John
2 Kate
3 ...
4 ...
and update the original table, replace the tv_program and user_name with the index number instead like
time tv_program user_name
xxx 1 1
xxx 2 2
... ... ...
Is there any simple way to do this? many thanks!!