Re: approaching a relational database

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Gotcha. thanks to everyone for the advice. I'm going to switch it to the 2 table format.

Thanks again,
Doug

David Eisenhart wrote:

I would go along the lines that Stas suggests.

You appear to have a two table database here:

Table1: tblHole

hole_id, hole_no,  course_id,  par, WH, MH, Trees1, Trees2, Trees3 etc...
-------   --------   ----------  ----  ---- ----    -----     -------  -----
1               1                 1
2               2                 1
3               3                 1
...
..
18             18               1
19              1                2
20              2                2
21              3                2

(Note the course_id field above acting as the foreign key to the table
tblCourse)
(You could make the hole_no, course_id pair of fields a unique index -
afterall there should never be more than one entry for each hole_no,
course_id pair)

Table2: tblCourse:

Course_id   Course_Name  State  County
----------    --------------   -----   -------
1                      xyz
2                      abc
...
...
10                    yyy


(The use of course_id in your description below is good (you are thinking
along the correct lines by introducing the foreign key field that references
the course table) However, if I understand it correctly you are proposing to
have a separate table for each hole attribute (1 table for par, 1 table for
WH etc.. etc..) which is messy and unnecessary.)

Good luck

David Eisenhart






"Doug Parker" <drparker@clam.rutgers.edu> wrote in message
3DFDE875.E63CA03@clam.rutgers.edu">news:3DFDE875.E63CA03@clam.rutgers.edu...

The grid for each course looks like this (excluding CourseName, State,

County,

Street, City, State)

           Hole1 | Hole2 | Hole 3 | ......... | Hole18
Par          9          4            7     ..........       6
WH         8          4            4     ..........       5
MH         5          4            4     ..........       5
Tees1      4          4            3     ..........       5
Tees2      3          3            2    ..........        5
Tees3     etc...
Tees4
Tees5

For every course, I have to enter in all of these variables.  It isn't

really

keeping score, it's just a table of all the information for a given

course -

par, wh (women's handicap), mh, etc.  What i did was pretty much make a

table

for every row.  Each table (par, for example) has a course_id that I set

in the

courses table (that holds the CourseName, State, County, Street, City,

State),

and then 18 more fields - one for each hole.  So it looks like:

"par" table
           course_id | Hole1 | Hole2 | Hole 3 | ......... | Hole18
                165         4          4            5     ..........

3

Is that alright?  it was the most reasonable thing I could think of, but

i'm

not too experienced in database design, so i figured i'd ask.

Thanks, Doug






--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux