Nika Javakhishvili
Nika Javakhishvili

Reputation: 462

SQL Server create correct relationship between tables

Well it's a noob question but I really appricate your answers.

I want to create a tournament table with start and end date columns. Each tournament contains 32th finale, 16th finale, semi final and final.

I can't figure out what would be the most correct way to design such a database

Upvotes: 0

Views: 39

Answers (1)

Darin Dimitrov
Darin Dimitrov

Reputation: 1039190

We can identify 2 entities: Tournament and Round. A Tournament can have many Rounds.

The Tournament table could contain the Start and End dates as columns:

Id: Primary Key
Start: Date 
End: Date

A Round table could contain the tournament id and round type (of course you could decide to add participants, score and any other relevant information to the round):

Id: Primary Key
TournamentId: Foreign Key pointing to the corresponding tournament
Type: Integer (that would identify the type of round 32, 16, 8, ..)

Upvotes: 3

Related Questions