View Single Post
  #1  
Old 12-01-2004, 11:07 PM
sully02 sully02 is offline
 
Join Date: Jul 2004
Posts: 161
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Looking for input on data organization/queries

I'm working on a project that will add a "team page" to my boards for all professional sports teams. As far as programming experience, I'm still a relative PHP/SQL newbie, but I've taken classes that teach C, C++, and Java, so I figure it won't be that hard for me to pick up. Right now, I'm working on organizing tables for the SQL database and figuring out the best arrangement. Right now, I want to get this done so I can work on the team standings portion of the project. That portion will put the team's division standings on the respective team page. Here's the tables I have along with items in each table:

clubhouse_sportname: sportid (smallint-2), sportname (varchar-200), sportabbrev (varchar-5)

clubhouse_conferences: confid (smallint-3), sportid (smallint-2), confname (varchar-200), confabbrev (varchar-5)

clubhouse_divisions: divid (smallint-3), confid (smallint-3), sportid (smallint-2), divname (varchar-100), divabbrev (varchar-8)

clubhouse_teams: teamid (smallint-4), divid (smallint-3), confid (smallint-3), sportid (smallint-2), teamname (varchar-100), teamabbrev (varchar-5)

Now, the way I'm thinking to do this would be to have the teams viewable by clubhouse.php?team=1, for example (Not sure of the exact terminology). At that point, I'd do a query to the teams table to get the team's data in regards to division, etc.

From there, I could do a query into a separate standings table to get the standings for each team. Then comes the interesting part. In the case of tiebreakers, I'd have to sort by multiple methods (For example, I'd have to sort by team record THEN division record, and so on).

Now that I've given you the information, my questions. I'm not asking how to do it, per se, but if how I'm doing it would be the most organized and efficient way. If you have any suggestions, I'd greatly appreciate it.

1] Is this the best way I can go about organizing my data?
2] Is the method I have in mind for doing queries the best one I could use?
3] Is it possible to sort using multiple criteria (multiple sorts of data) using SQL queries?

And of course, any other suggestions would be greatly appreciated.
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01251 seconds
  • Memory Usage 1,762KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete