Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Beginning Database Design Solutions ISBN: 978-0-470-38549-4
This is the forum to discuss the Wrox book Beginning Database Design Solutions by Rod Stephens; ISBN: 9780470385494
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning Database Design Solutions ISBN: 978-0-470-38549-4 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #11 (permalink)  
Old May 10th, 2014, 01:49 PM
Rod Stephens's Avatar
Wrox Author
Points: 3,145, Level: 23
Points: 3,145, Level: 23 Points: 3,145, Level: 23 Points: 3,145, Level: 23
Activity: 50%
Activity: 50% Activity: 50% Activity: 50%
 
Join Date: Jan 2006
Location: , , .
Posts: 641
Thanks: 2
Thanked 96 Times in 95 Posts
Default

Yes, you could do that. The GradeResults table would have fields:

  • CourseOfferingId (or CourseId)
  • MinScore
  • Grade

MinScore would be the minimum score you need to get the grade.

To find the grade for a score of Score, you would make a query something like this:

Code:
SELECT TOP (1) Grade FROM GradeResults
WHERE MinScore <= Score
ORDER BY MinScore DESCENDING
The TOP (1) part selects only the first record returned by the query, which should be the one that applies to the score.

In practice, a program might load these values when it starts so it doesn't need to look in the database every time it needs them. For example, it could make an array with 100 entries and then just use the score as an index into the array. It would waste some memory but would be very fast and the amount of memory would be small.
__________________
Rod

Rod Stephens, Microsoft MVP

Essential Algorithms: A Practical Approach to Computer Algorithms

(Please post reviews at Amazon or wherever you shop!)
Reply With Quote
The Following User Says Thank You to Rod Stephens For This Useful Post:
frdata (May 11th, 2014)
  #12 (permalink)  
Old May 11th, 2014, 11:00 AM
Authorized User
Points: 80, Level: 1
Points: 80, Level: 1 Points: 80, Level: 1 Points: 80, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2011
Posts: 20
Thanks: 7
Thanked 0 Times in 0 Posts
Default

Fantastic solution.

The GradeResults structure is what I'm looking for and it fits nicely in the model. Incredibly concise.

Your sql code on how to use it is also very helpful.

I could load the GradeResults table in a collection and use vba to determine the grade of a particular score.

Thank you so much
Reply With Quote
Reply


Thread Tools
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

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
How do i generate random numbers with mysql for students 2 register on a school site www.freegist.com Beginning PHP 0 April 16th, 2012 06:02 AM
Tutor-led ASP.NET courses kefi2927 BOOK: ASP.NET Website Programming Problem-Design-Solution 4 January 15th, 2005 10:44 PM



All times are GMT -4. The time now is 10:59 PM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.