MySQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMySQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old September 24th, 2004, 04:37 PM
Talraith Talraith is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Posts: 1 Talraith User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Table and/or Query Help

Hello, I am adding a section to my site to track high scores for different levels in a game. I am looking for the optimal table structure and optimal query to gather high scores for each level. I am planning to have two tables: one to keep track of meta data for each level and one for the actual scores.

boards table
-----------------------------------------
boardID INT(11) PRIMARY KEY
large_image VARCHAR(20)
small_image VARCHAR(20)
number_scores INT(11)

scores table
------------------------------------------
entry INT(11) AUTONUMBER / PRMIARY KEY
boardID INT(11) UNIQUE
accountID INT(11) UNIQUE
name VARCHAR(20)
initials CHAR(3)
score FLOAT

To pull a list of all scores ranked in order, I plan to use the following query:
SELECT boards.boardID, scores.name, scores.initials, scores.score FROM boards LEFT JOIN scores USING (boardID) ORDER BY boards.boardID, scores.score, scores.entry;

The above query does work, but I am afraid what the performance will be like when each level (about 50) has several hundred entries.

Is there a way I can run a single query and limit the number of results returned for each board? Or is it more efficient to run a query for each level and use the LIMIT clause?

Thank you for your help

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMySQL Development > Table and/or Query Help


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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 On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway