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 6955443
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T14:44:12+00:00 2026-05-27T14:44:12+00:00

I wish to do a special type of scaling for my data. Is it

  • 0

I wish to do a special type of scaling for my data.

Is it possible to query a database which has the following ints in a column:

10
5
5
3
1
1
0
1
5
2
2

And produce the following representation via a query:

1.0
0.8
0.8
0.6
0.2
0.2
0.0
1.0
0.8
0.4
0.4

So the max value becomes 1.0 and 0 remains as 0. Then we have the set of unique values excluding 0, which is 10, 5, 3, 2, 1. The length of this set is 5. The inverse is 0.2. Then the next largest value in our column, 5, become 1 – 0.2 = 0.8. Then the next largest value, 3, becomes 0.8-0.2 = 0.6, and so on.

10->1.0, 5->0.8, 3->0.6, 2->0.4, 1->0.2, 0->0

Or would you recommend that the programming language doing the query should instead perfom this scaling.

I’m the only one who will be quering the database and I haven’t chosen my database yet, but will be using one that is open-source or SQL-Server. This type is scaling is very important for my application and I will be using it on different tables. I will be programming in Python3.

EDIT:
SQL Server is also an option, as well as open source dbs

  • 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-27T14:44:13+00:00Added an answer on May 27, 2026 at 2:44 pm

    I would recommend PHP:

    $myColumnArray = /* load mysql values here */;   
    // order numbers smallest to largest
    $uniqueElements = sort(array_unique($myColumnArray));
    // calculate increment
    $incriment = count($uniqueElements);
    // go thru elements in orig array and replace with weighted value
    foreach($myColumnArray as &$val){
        // get position of element (i.e. "4th largest")
        $position = array_search ($val, $uniqueElements);
        // set it equal to weighted value
        $val = $position * $increment;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wish fetch data in a XML file, where Tag is a variable.. My
I wish to add the mouseover events to a panel which contains more than
I wish I could figure this out. I need to produce a table with
I wish to capture data from http://www.kitco.com/texten/texten.html : <html> <head> <title>Text Only Market Page</title>
In this scenario I wish too bypass my normal error logging, which wont work,
In my controller I wish to return HTML inside a json response, which will
I wish to target ARMv6 with VFP Android device. I have following line in
Ultimately I wish to produce a compressive Contact Manager with some specific features. I
In the Eclipse Project Explorer, I wish to add either a special icon or
I have the following query SELECT * FROM `articles` WHERE ( ( UCASE( `title`

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.