Jump to content

to much info in database


soullessj

Recommended Posts

hi im trying to create a database but i end up with to many sections in the tables. im using and id section to link mulitole tables and display the information from the tables corresponding the id.

 

ie. characters from a tv show.

 

id              1

 

charac      character 1

actor        actor1

desc          description

 

charac 2    character 2

actor 2      actor 2

desc 2      description 2

 

IE.

 

tv shows

 

id                  1

 

name            show name

desc            show description.

 

if i wanted to display info for show 1 the query would say that table 1 id(tv show) = table 2 id(characters)

and then i would be able to display the info from those tables. but if there are alot of characters then it becomes a bit of a pain having to repeat the sections in the table for each character charc 1, charac2, charac3 etc...

 

is there anyway to make this simpler either by being able to store and retrieve them differntly or store the information in an external file such as an xml and retrieve it from there.

 

any help would be appreciated thanks

Link to comment
Share on other sites

im still new to php thats why i was wondering if it would be easier like that . for example if there were 20 characters i would have to create a name desc etc.. table for each one to store the information like charac1, charac 2, charac 3.

desc 1, desc 2, desc 3. as you can see it gets a bit long and tiresome to do that for each character.

Link to comment
Share on other sites

Your DB is lacking a proper design that's why it's so hard to retrieve the information.

 

tv_show (tv_show_id, ..)

tv_show_character (tv_show_character_id, tv_show_id, played_by, ..)

 

actor (actor_id, ..)

 

To get the TV characters and the actor information.

 

SELECT ..
FROM tv_show_characters T1
LEFT JOIN actor T2 ON T2.id = T1.played_by
WHERE T1.tv_show_id = ?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.