Wrox Programmer Forums
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 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 May 10th, 2014, 01:49 PM
Rod Stephens's Avatar
Wrox Author
Join Date: Jan 2006
Posts: 647
Thanks: 2
Thanked 96 Times in 95 Posts

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:

SELECT TOP (1) Grade FROM GradeResults
WHERE MinScore <= Score
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 Stephens, Microsoft MVP

Essential Algorithms: A Practical Approach to Computer Algorithms

(Please post reviews at Amazon or wherever you shop!)
The Following User Says Thank You to Rod Stephens For This Useful Post:
frdata (May 11th, 2014)
Old May 11th, 2014, 11:00 AM
Authorized User
Join Date: Nov 2011
Posts: 20
Thanks: 7
Thanked 0 Times in 0 Posts

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

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 11:44 PM

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