Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 413715
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T18:12:41+00:00 2026-05-12T18:12:41+00:00

This question is kind of complicated and I do not even know how to

  • 0

This question is kind of complicated and I do not even know how to Google for it in the first place. I am even having loads of difficulty phrasing my question coherently but here goes!

Hi guys, I need some help with some SQL. I am making a database (DB2 Express-C) backend for a company’s corporate training software.

The intention is to compare a candidate’s score to a ‘raw score-percentage value’ match such as

eg:
Game I

Words identified(raw score) – Percentage value

10 – 0%

40 – 20%

60 – 50%

90 – 80%

200 – 100%

So for example if an employee scores 30 words, according to the values set above, he will be awarded 0%
While if another scores 91 words, she will be awarded 80%
And yet another scores 300 words, score will be 100%

As the sample above indicates, the series of values is definitely not linear. So therefore I require a table capable of storing raw scores (quantitative or qualitative) paired with a corresponding percentage value for different games.

I thought of a method as follows (feel free to critique)
A database table with 20 columns (named 0-100% in 5% intervals i.e. col name 0, 5, 10, 15 .. 100) with a column for the Game ID. Then I figured I can access the column ordinals and iterate while comparing the value to each column. On encountering a value larger than the raw score, the previous column name is taken as the percentage to be awarded. But thinking about it, ordinals seem terribly inefficient/unwieldy.

Then another method I thought of was to use 2 columns, one for the Game ID and another as an array datatype. A fixed array of 20 elements will be defined for each row. Then if the element is NOT NULL, it will be used as the first basis of comparison. The array will be advanced through until a value greater than the candidate’s score is encountered. So the previous NON NULL value will be used as the percentage to be allocated.

However, I am pretty dissatisified with such an inelegant solution and I am hoping if you have any better solutions in mind.

Thanks so much all and i really appreciate you reading this and helping me.

I am very keen to learn and so please do critique my methods and thinking.

EDIT!:
There seems to be a misunderstanding between me and well intentioned people.

I need to emphasize that the example of words is just an example. There are many other games like number of jumps. number of clicks and etc. So having one two-column table will not be useful cos I will require a value-percentage pair from 0-100% for n games.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T18:12:42+00:00Added an answer on May 12, 2026 at 6:12 pm

    Try this:

    • Create a table called scorelookup with two columns, called percentage and words. This table has to be filled with your raw score to percentage lookup values
    • I’m assuming that you have a table called scores containing all pertinent data (represented by field1,field2 and field3 in the example below), and a column called rawscore, containing the test subject’s raw score in words.

    Then we just need this query:

    select field1, field2, field3,rawscore, (
        select max(percentage) from scorelookup where words < r.rawscore  ) rank
    from scores r;
    

    If I understood you question correctly that should do the trick.

    Edit (after your edit):

    Just as your example is an example, this example is an example.

    • Extend table scorelookup with a colum called quiz
    • Alter column name words in table scorelookup to scoreable
    • Adapt query to, assuming for the sake of this example that we will look at some score called Test2

    It should look like this now:

    select field1, field2, field3,raw, (
        select max(percentage) from scorelookup where scoreable < r.rawscore and quiz='Test2'  ) rank
    from scores r;
    

    OK, there’s still some work to to (this is just an example after all) but this should get you started.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know this question has kind-a started religious wars in past and there might
Note: There was not any question with this kind of problem here or anywhere...
This may not be the kind of question one should ask on StackOverflow, but
I know this is not a straight up question, so if you need me
This question kind of starts where this question ends up. MATLAB has a powerful
This question is kind of a follow up to this question I asked a
This question is kind of related to another question but I have a specific
Kind of like this question I have many text snippets that I use many,
As a kind of follow on to this question , what specific services are
I am kind of new to C# and Asp.Net, so this question might sound

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.