Forums: » Register « |  Free Tools |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support |

New Free Tools on Dev Shed!

#1
October 23rd, 1999, 01:57 PM
 xale Guest Posts: n/a   Time spent in forums: Reputation Power:
good evening!

i'm building my first sql (mysql) database
and i'm faced with a little big problem.
(but not the first one i query...)

i'd like to have the following structure:

id=1 nom=musique
id=2 nom=theatre

id=10 nom=disco ref=1
id=11 nom=concert ref=1
id=12 nom=theatre d'objets ref=2

id=100 nom=pop ref=10&11
id=101 nom=rock ref=10&11
id=102 nom=punk ref=10

so, pop and rock appear in the group
disco an concert and the tree are under
music... but punk can only appear in concert/music...

can somebody help me? does anybody know
where i can lern a little bit more of
table architecture (if possible free and
on-line! ... i have plenty of time and
a litle bit less of money... sorry...)?

thank you. ciaaaaaaao

a.l.e

#2
October 26th, 1999, 02:04 PM
 DesertFox Guest Posts: n/a   Time spent in forums: Reputation Power:
a.l.e.

Hi,

You can have 1 huge table and list all possible combinations.

NOM1 NOM2 NOM3
musique disco pop
musique concert pop
musique disco rock
musique concert rock
musique disco punk
theatre theatre d'objets

But, making 3 tables:

First table will be:
T1-ID NOM
1 musique
2 theatre

Second Table:
T2-ID NOM T1-ID
10 disco 1
11 concert 1
12 theatre d'objets 2

Third Table:
T3-ID NOM T2-ID
100 pop 10
100 pop 11
101 rock 10
101 rock 11
102 punk 10

The various T?-ID are your "linking fields" (The fields that will relate all three tables together).

Hope this helps.

 Viewing: Dev Shed Forums > Databases > MySQL Help > designing a structure