Welcome to the dBforums forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions, articles and access our other FREE features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload your own photos and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact support.

If you prefer not to see double-underlined words and corresponding ads, place your cursor
here for ContentLink opt out.

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, 12: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, 15:43
Brett Kaiser Brett Kaiser is offline
SQLTeam Scrub
 
Join Date: Nov 2002
Location: Jersey
Posts: 9,127
year needs to be added to team and players table
__________________
Brett
8-)
My Blog dbforums Yak CorralRadio 'Rita
dbForums Member List SQLTeam Member List
It's 5:00 Somewhere Pearls
The physical order of data in a database has no meaning.
Reply With Quote
  #3 (permalink)  
Old 09-18-07, 18:43
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 13,556
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

pre-order my book Simply SQL from Amazon
Reply With Quote
  #4 (permalink)  
Old 09-19-07, 04: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

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