database - How to avoid repeated content in mysql tables? -



database - How to avoid repeated content in mysql tables? -

i have 2 tables , have "many many" relation. problem in mirror table have 2 more fields "name" , "status". name field values "youtube, dailymotion , mp4upload" , status values "subbed, dubbed , raw". every link placing these value , duplication occurs.

demo:

mirror table

id name link status 1 mp4upload link 1 subbed 2 mp4upload link 2 subbed 3 mp4upload link 3 subbed 4 mp4upload link 4 raw 5 mp4upload link 5 raw 6 youtube link 6 dubbed 7 youtube link 7 dubbed

is there way can avoid repeated content relation? consider above relation. 1 episode have many mirrors , many mirrors belong 1 episode. solved using 3rd table pivot table episode_mirror.

other tables are

episode table

id name 1 first episode 2 sec episode 3 3rd episode 4 4th episode

episode_mirror (pivot table)

id episode_id mirror_id 1 1 1 2 1 2 3 1 3

i hope create sense every 1 , lot.

create table both name , status.

status_id | status 1 | subbed 2 | dubbed 3 | raw name_id | name 1 | mp4upload 2 | youtube 3 | dailymotion

then in first table, utilize ids corresponding new tables

id name_id link status_id 1 1 link 1 1 2 1 link 2 1 3 1 link 3 1 4 1 link 4 3 5 1 link 5 3 6 2 link 6 2 7 2 link 7 2

this save big amount of space , repetition repeating strings.

mysql database database-schema

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -