Web database design question

  • Thread starter Thread starter Anonymous
  • Start date Start date
A

Anonymous

Guest
Hi.

I'm creating a text based fighting game simulator that'll have people saving their characters on mySQL. How should I design my table(s) to store each characters fighting history?

For example:

John has wins against Eric, Joe, Peter, Kenny, and Chuck.
Joe has wins against Eric and Peter. Losses against Kenny and Chuck.

How would I design a database for this? I'm thinking the only way to do this is by creating a seperate table for each fighter. This is probably too broad of a question to ask but I'd appreciate any kind of input.
 
You need only 2 tables for this:
table 1 (users): userID, username, other_info
table 2 (battles): winner(refers to "userID" in "users"), loser (refers to "userID" in "users"), other_info

Greetz Daan
 
Thanks DoppyNL.

After I posted this question I figured out a solution that was somewhat similar to yours.

create table history
( Date date,
Winner char(25),
Loser char(25)
);
 
Back
Top