If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > General > Database Concepts & Design > Soccer Database Relationship

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-15-07, 11:27
Nanni Nanni is offline
Registered User
 
Join Date: Sep 2007
Posts: 2
Soccer Database Relationship

Hi to all and sorry for my english.

I'm a newbie in database and I have a problem in database design.
The goals is a a soccer database.

I have separate table for:

Season Year (id,Year)
Team Category (id,Category)
Team (id,Name,address,id coach.....)
Players (id,name,team id....)

The table are yet incomplete.

The other table are not important for my problem.
The problem is the table's relationship.

Every year some teams are relegated (Up/down) in other Category.
Every year some players change team.

I need to query...in the Season year x and in the Team Category x
which teams did play?

I need to query... in the Season year x and in the Team Category x
which players for that x team?

Thanks in advance for any help.

Regards Nanni
Reply With Quote
  #2 (permalink)  
Old 09-18-07, 14:43
Brett Kaiser Brett Kaiser is offline
Window Washer
 
Join Date: Nov 2002
Location: Jersey
Posts: 10,303
year needs to be added to team and players table
__________________
Brett
8-)

It's a Great Day for America everybody!

dbforums Yak CorralRadio 'Rita
dbForums Member List
I'm Good Once as I ever was

The physical order of data in a database has no meaning.
Reply With Quote
  #3 (permalink)  
Old 09-18-07, 17:43
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
Quote:
Originally Posted by Nanni
I need to query...in the Season year x and in the Team Category x
which teams did play?

I need to query... in the Season year x and in the Team Category x
which players for that x team?
homework assignment
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #4 (permalink)  
Old 09-19-07, 03:17
Nanni Nanni is offline
Registered User
 
Join Date: Sep 2007
Posts: 2
Hi to all and Thanks for answers.

Dear r937 this project isn't a homework assignment.

I am trying to understand something of Database and SQL.
This is my first case study.
Enclosed a screenshot of my schema.
It isn't no finished,but i have a lot of difficulty to complete
and query it.

eg how to query Table Calendario(fixture) for have a Table
with Name of Team1, Name of Team2, Goal Team1(GoalSquadraCasa),
Goal Team2(GoalSquadraOspite)?
I have name of team in separate Table(Squadre) and ID of Team instead
of name, in Table Calendario(fixture).
In the following query I get id but not the name:

SELECT DISTINCT Calendario.IdSquadraCasa AS [Squadra Casa], Calendario.IdSquadraOspite AS [Squadra Ospite], Serie.NomeSerie, Anno.Anno, Calendario.NumeroGiornata, Calendario.DescrizioneGiornata
FROM ((Serie INNER JOIN ((Anno INNER JOIN SerieAnno ON Anno.IdAnno=SerieAnno.IdAnno) INNER JOIN Stagioni ON Anno.IdAnno=Stagioni.IdAnno) ON (Serie.IdSerie=Stagioni.IdSerie) AND (Serie.IdSerie=SerieAnno.IdSerie)) INNER JOIN Calendario ON Stagioni.IdStagione=Calendario.IdStagione) INNER JOIN (Squadre INNER JOIN SquadreStagioni ON Squadre.IdSquadra=SquadreStagioni.IdSquadre) ON Stagioni.IdStagione=SquadreStagioni.IdStagione
WHERE (((Serie.NomeSerie)="SerieA") AND ((Calendario.NumeroGiornata)="Giornata N. 1") AND ((Calendario.DescrizioneGiornata)="Andata"));

Any Help for improve this schema will be very appreciated.

Regards Nanni
Attached Thumbnails
Soccer Database Relationship-db.jpg  
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On