Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Help with a DB design.

Author  Topic 

Eagle_f90
Constraint Violating Yak Guru

424 Posts

Posted - 2003-01-20 : 00:57:52
Hi, I run an online game and we are not introducing the ability to have aillies with other players. The problem is that anyone can allie with anyone and the amount of players is constintly changing. Does anyone know of a good way to design a table in my DB so I can have people easly choose there aillies? I am using SQL 2000 and ASP. All players have a unique ID called "PlayerID" which is a text filed.

Tahnks for the help.

--
For those with wings, fly to your dreams

It is all or nothing there is no in-between

Remember who I was... For me

rihardh
Constraint Violating Yak Guru

307 Posts

Posted - 2003-01-20 : 02:57:32
Hmmm..., maybe a many to many relationship?

Go to Top of Page

Eagle_f90
Constraint Violating Yak Guru

424 Posts

Posted - 2003-01-20 : 03:33:32
I kinda figured it would requier that but from what I understand relasions are done coulmn to coulmn. And I don't even know a good way to make the TABLE (as stated in the first post I need help making a table) for this.

--
For those with wings, fly to your dreams

It is all or nothing there is no in-between

Remember who I was... For me
Go to Top of Page

rihardh
Constraint Violating Yak Guru

307 Posts

Posted - 2003-01-20 : 04:00:06
Instead of flying "to your dreams", you should fly to your nearest bookstore...

Usually I don't do T-SQL, but today is your lucky day:

CREATE TABLE [dbo].[allies_t] (
[player_id] [int] NOT NULL ,
[player_allie_id] [int] NOT NULL
) ON [PRIMARY]

don't forget to make relations to your players table.

Go to Top of Page

Eagle_f90
Constraint Violating Yak Guru

424 Posts

Posted - 2003-01-20 : 04:27:30
Well thanks for the code I think you did the round about way to answering my question. From what I can see your suggesting the best way to do this is to have an entree for each player and there allie where if a player has 3 allies they have 3 entryes? (BTY I have Sam's Teach your self T-SQL in 21 days)

--
For those with wings, fly to your dreams

It is all or nothing there is no in-between

Remember who I was... For me
Go to Top of Page

rihardh
Constraint Violating Yak Guru

307 Posts

Posted - 2003-01-20 : 04:51:44
Since you didn't apply any DDL, It's most likely way.

(BTY 21 days is not enough...)

Go to Top of Page

mr_mist
Grunnio

1870 Posts

Posted - 2003-01-20 : 05:14:42
quote:

From what I can see your suggesting the best way to do this is to have an entree for each player and there allie where if a player has 3 allies they have 3 entryes


You can't really avoid that unless you want to de-normalize your player table (which would prevent you from having a flexible number of allies.)

-------
Moo.
Go to Top of Page

Eagle_f90
Constraint Violating Yak Guru

424 Posts

Posted - 2003-01-20 : 05:51:30
quote:

Since you didn't apply any DDL, It's most likely way.

(BTY 21 days is not enough...)




For give me (have not gotten far in my T-SQL book) what is DDL?

--
For those with wings, fly to your dreams

Dearms are what are found at the end of reality, and your reality if what is found at the end of your dreams.
Go to Top of Page

mr_mist
Grunnio

1870 Posts

Posted - 2003-01-20 : 06:07:45
quote:

what is DDL?




Data Definition Language, or, in other words, the stuff you would run in Query Analyzer to create the tables you have already. For example

CREATE table players
(
playername varchar(20) null,
playerid varchar (30) not null,
health int null
)


If you provide such things, then people can easily see what kind of table structure you have and can test their replies to your posts without having to make up tables to do it.

-------
Moo.
Go to Top of Page
   

- Advertisement -