Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
176 views
in Technique[技术] by (71.8m points)

MYSQL Database Structure for 2-round Events

I'd like to create a database to store information about events with the following details for each record:

Event, Player 1 name, Player 2 name, Final score

Round 1:
Date, location, Important detail 1, Important detail 2

Round 2:
Date, location, Important detail 1, Important detail 2

Could someone tell me how this would translate to a mySQL database please? I mean by that a suitable database name, whether I need one or multiple tables, what fields I need to create.

I might be over-complicating things in my mind, but I'm wondering if there are "layers" in a database or whether I would just have individual fields such as round1 date, round1 location, ...., round2 date etc, as opposed to something like event1 rounds with sub tables for each round.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

When naming database it is normally project or company name. in this case your game name

for keeping data you need to consider normalization rules. from that you can think how many tables and which table data should go. in this case one event has multiple rounds

when naming tables i prefer prefixing parent so things can be find easily.

So putting altogether

Database name: company/game name

event
event_id(unique), player 1, player 2, final score ,

event_round
event_id, round_id(unique), round number, date, location,

event_round_important
round_id, important_data,


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...