Friday, March 23, 2012

please correct me if I'm wrong about relational dbase setup

http://www.wowcentral.com/random/relations_example.gif
(I whipped up this little example in access really quick so I could kind of
illustrate it)
Okay, I have a dbase with info about a game and stuff.
There are races, and classes and skills etc.
Races have many classes, and classes have many skills
Now, I need to display a page about a race...and on that page, it will
display which classes are available to it.
So, you click on a class, and that will load a page about that class
describing it and what skills are available to that class.
Now, if each race only had one class, I would just make a cell on the races
table called class_id. But because each race (8 of them) will have up to 8
classes I gotta make a second table that says which classes are available to
each race.
I did this in tblRclasses.
I did the same thing for classes and skills.
Now, my friend is telling me that this is not a relational database because
the tables aren't sharring info but, like I said a second ago, if each race
only had one class, I wouldn't need the "middle man" table.
I don't see how this is NOT relational, and to me, I don't think it gets
anymore relational then this.
It is still sharing information from table to table, just not directly from
one to another because there are so many items per, I can't just add a cell
to the races table for every class that there is.
Ontop of this, I'll probably have a page were people can just check out
skills and stuff, and when they click on that skill, it will say, this skill
is available to this class...so from there, I'll be linking back to classes
and from classes to races.
So, I need you guys to set me or him straight.
Am I infact totally off and what I've described is NOT a relational dbase
structure or is my friend wrong and this IS a relational dbase structure?
To him, (if I'm understanding correctly) it would only be relational if it
was one table to another ie, races directly to classes. But because I'm
doing races to rclasses/rclasses to classes it's not relationa.
Thanks
Robso, I say one to one or one to many is relational
but if I'm hearing him correctly he's saying only one to one is relational|||Robert ,it will be very useful If you post DDL + sample data + expected
result.
"Robert Blackwell" <robbieatwowcentraldotcom> wrote in message
news:epQlBrpdDHA.3836@.tk2msftngp13.phx.gbl...
> http://www.wowcentral.com/random/relations_example.gif
> (I whipped up this little example in access really quick so I could kind
of
> illustrate it)
> Okay, I have a dbase with info about a game and stuff.
>
> There are races, and classes and skills etc.
> Races have many classes, and classes have many skills
> Now, I need to display a page about a race...and on that page, it will
> display which classes are available to it.
> So, you click on a class, and that will load a page about that class
> describing it and what skills are available to that class.
> Now, if each race only had one class, I would just make a cell on the
races
> table called class_id. But because each race (8 of them) will have up to 8
> classes I gotta make a second table that says which classes are available
to
> each race.
> I did this in tblRclasses.
> I did the same thing for classes and skills.
> Now, my friend is telling me that this is not a relational database
because
> the tables aren't sharring info but, like I said a second ago, if each
race
> only had one class, I wouldn't need the "middle man" table.
> I don't see how this is NOT relational, and to me, I don't think it gets
> anymore relational then this.
> It is still sharing information from table to table, just not directly
from
> one to another because there are so many items per, I can't just add a
cell
> to the races table for every class that there is.
> Ontop of this, I'll probably have a page were people can just check out
> skills and stuff, and when they click on that skill, it will say, this
skill
> is available to this class...so from there, I'll be linking back to
classes
> and from classes to races.
> So, I need you guys to set me or him straight.
> Am I infact totally off and what I've described is NOT a relational dbase
> structure or is my friend wrong and this IS a relational dbase structure?
> To him, (if I'm understanding correctly) it would only be relational if it
> was one table to another ie, races directly to classes. But because I'm
> doing races to rclasses/rclasses to classes it's not relationa.
> Thanks
> Rob
>|||I don't have any data etc yet because I'm trying to create the structure
properly first :(
But, as far as results go, take this website for example (it's the official
page of the fansite I'm working on)
http://www.worldofwarcraft.com/wow/townhall/
For reasons I don't understand, that entire site is static. But what I'm
planning to create on my page, is totally dynamic.
So say on that main page, you have the races and the images loaded
statically maybe, but the list of monsters is loaded dynamically and so are
the regions via repeat regions and stuff.
So, let's click on a race...Night Elves.
When you go to the NE page, all that stuff is loaded dynamically from the
dbase, the image, description, and then the the classes and races.
Now, i'm using the "inbetween" table rclasses to link races and classes
together ande that's how I'd get the info for classes. On that page, if you
click a class, it loads another dynamic page showing the information about
that class...and then on the class page, it will not only show the
informtaion about that class, but when more info is made available to the
public, I'm going to list which skills are available to each class...then
when you click the skill it loads up a skills description page etc...
And this goes for everything I'm trying to accomplish. Linking races,
classes, skills, regions and monsters together because races and monsters
come from a region and classes come from a race and skills come from classes
etc. etc. etc.
That's the best I can do to describe my intended out put I think.|||Robert
> For reasons I don't understand, that entire site is static.
If I undestand you correctly you are still planing you business logic of the
application.
Do you have database ?
If you do what is relationships between tables and what are the tables?
If you need some output report to be created by T-SQL please populate dummy
data and show us what is expected result.
"Robert Blackwell" <robbieatwowcentraldotcom> wrote in message
news:Oq0f1BqdDHA.2112@.TK2MSFTNGP10.phx.gbl...
> I don't have any data etc yet because I'm trying to create the structure
> properly first :(
>
> But, as far as results go, take this website for example (it's the
official
> page of the fansite I'm working on)
> http://www.worldofwarcraft.com/wow/townhall/
> For reasons I don't understand, that entire site is static. But what I'm
> planning to create on my page, is totally dynamic.
> So say on that main page, you have the races and the images loaded
> statically maybe, but the list of monsters is loaded dynamically and so
are
> the regions via repeat regions and stuff.
> So, let's click on a race...Night Elves.
> When you go to the NE page, all that stuff is loaded dynamically from the
> dbase, the image, description, and then the the classes and races.
> Now, i'm using the "inbetween" table rclasses to link races and classes
> together ande that's how I'd get the info for classes. On that page, if
you
> click a class, it loads another dynamic page showing the information about
> that class...and then on the class page, it will not only show the
> informtaion about that class, but when more info is made available to the
> public, I'm going to list which skills are available to each class...then
> when you click the skill it loads up a skills description page etc...
> And this goes for everything I'm trying to accomplish. Linking races,
> classes, skills, regions and monsters together because races and monsters
> come from a region and classes come from a race and skills come from
classes
> etc. etc. etc.
> That's the best I can do to describe my intended out put I think.
>|||One-to-many, one-to-one and many-to-many are all perfectly relational. It is all about how you model
the relations in the data model:
One to one: A common column in both tables which is unique (PK or UNIQUE constraint) in both tables.
One-to-many: A common column in both tables. In one table it is PK (the referenced table), in the
other it allow duplicates and is a FOREIGN KEY that references the PK of the referenced table.
Many-to-many: A table in between the two tables, where you keep the PK from both tables (as FK
referencing each of the other table's PK). This table creates your many-to-many relationships.
--
Tibor Karaszi, SQL Server MVP
Archive at: http://groups.google.com/groups?oi=djq&as ugroup=microsoft.public.sqlserver
"Robert Blackwell" <robbieatwowcentraldotcom> wrote in message
news:OuK0sspdDHA.3128@.TK2MSFTNGP09.phx.gbl...
> so, I say one to one or one to many is relational
> but if I'm hearing him correctly he's saying only one to one is relational
>

No comments:

Post a Comment