Wrox Programmer Forums
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 18th, 2006, 01:26 PM
Registered User
 
Join Date: Jun 2006
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default Database Desing

Aloha,

I'm trying to design a database to track teams scores. These teams can play several times a day. They also play in different towns, so they will have away scores and home scores. I would also like to pull queries based on scores per month away and home. Thanks in advance:)

 
Old June 18th, 2006, 01:40 PM
Friend of Wrox
 
Join Date: Oct 2004
Posts: 564
Thanks: 0
Thanked 4 Times in 4 Posts
Default

Aloha from a landlocked surfer!

I would do two tables:

1 - Teams
    =====
    TeamNumber (Number (could be autonumber))
    Name (Text)
    and whatever other info you want

2 - Games
    =====
    GameNumber (Number (could be autonumber))
    TeamNumber (Number - references Teams Table)
    Date (Date Field)
    HomeIndicator (Yes/No Field)

    Create a relationship between Teams.TeamNumber and Games.TeamNumber - a 1 to many relationship

Now you can report by team, and separate by the HomeIndicator and also filter by date. I'll be in and out today, but would be happy to help further as you go through this.

Mike

Mike
EchoVue.com
 
Old June 18th, 2006, 01:44 PM
Registered User
 
Join Date: Jun 2006
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Mahalo, echovue


I'll give it a try and thanks for the quick response.

 
Old June 18th, 2006, 01:58 PM
Registered User
 
Join Date: Jun 2006
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Mike another question. How do I identify that team number 1 played team number 10? Do I also need a table for scores? Would they go in the Games table.

 
Old June 18th, 2006, 02:08 PM
Friend of Wrox
 
Join Date: Oct 2004
Posts: 564
Thanks: 0
Thanked 4 Times in 4 Posts
Default

Good question.

What about changing the Games table to...
GameNumber
HomeTeamNumber
HomeTeamScore
AwayTeamNumber
AwayTeamScore

I think that should do it, and we can build queries off there that could tell us all kinds of things.


Mike
EchoVue.com
 
Old June 18th, 2006, 02:09 PM
Friend of Wrox
 
Join Date: Oct 2004
Posts: 564
Thanks: 0
Thanked 4 Times in 4 Posts
Default

Welcome to the forum as well.

You'll find it a great resource!

Mike

Mike
EchoVue.com
 
Old June 18th, 2006, 02:34 PM
Registered User
 
Join Date: Jun 2006
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Mike would this work?


Schedule = Table GamesPlayed = Table
DateId = Number ScheduleId Autonumber
ScheduleDate = Date DateId #
                         AwayId #
Home = Table HomeId #
HomeId = # AwayScore #
HomeTeam = Text HomeScore #

Away = Table
AwayId = #
AwayTeam = Text

Relationships

HomeId 1 to many to Games Table HomeId
AwayId 1 to many to Games Table AwayId
DateId 1 to many to Schedule Table DateId




 
Old June 18th, 2006, 11:24 PM
Friend of Wrox
 
Join Date: Oct 2004
Posts: 564
Thanks: 0
Thanked 4 Times in 4 Posts
Default

Hi SurferDude,

Sorry, I got tied up for a while. That would work, however it looks like the Away table would be the same as the home table. You could tie the awayID and HomeID into the same table, thus avoid duplicating the data.

Mike

Mike
EchoVue.com
 
Old June 19th, 2006, 09:25 AM
Friend of Wrox
 
Join Date: Dec 2005
Posts: 142
Thanks: 0
Thanked 0 Times in 0 Posts
Default

It would be easier to pull queries if you kept the Games as a single table with a format like:
Game ID (autonumber field)
Home Team (pick list of teams from Team table)
Away Team (pick list of teams from Team table)
Home Score
Away Score
Date/Time
Location

In general you want the tables you have to correspond to the major 'nouns' that you're looking at, in this case Teams and Games.


 
Old June 19th, 2006, 03:17 PM
Registered User
 
Join Date: Jun 2006
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks guys this what I got and it works. I figured out the Home and Away was not good design. Thanks again for the help:)

Tables
Team Games Schedule
ScheduleId ScheduleId DateId
HomeName DateId ScheduleDate
HomeId AwayId Day
AwayId HomeId
AwayName AwayScore
                HomeScore



Now I'm trying to create a query that gives me the total score
for each team for April.

Thanks in Advance






Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem to restore database in C#2005 database acmuralee MySQL 0 March 25th, 2008 04:42 AM
Microsoft JET Database Database Engine (0x80040E09 cannielynn0312 Classic ASP Professional 2 December 17th, 2007 02:50 AM
Copying Table From one Database To Anoter Database jayanth_nadig VB Databases Basics 1 June 19th, 2006 02:39 PM
Desing Pattern tilakkalyan J2EE 3 February 14th, 2006 07:04 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.