Disclaimer: I'm a newb to sql, And This is a more general question than I would prefer to ask.

So I have a table with a list of English words and a column labeled votes with a bigint value representing the frequency of that word's use. I'm just learning now how to get sql to talk with my node production environment. I am also taking a crash course in standardized query language itself. So far, I'm not seeing an analogue to the javascript data structures and iteration functions I'm used to, So how would one efficiently:

A) (while alphabetized) isolate 1/128th of the records at a time

B) assign the top 8 most voted words of each isolated 'chunk' (still in alphabetical order) to javascript vars with iterated numbers in the name (or an array)

C) assign 9th through 68th in terms of voting, also still in alphabetical order, but assigned to indexes after the first 8.

Also, the 1/128 grouping also has to have an iterate in it's naming scheme, applied either to the var name before the other iterate, or in the name of the index that contains the sorted word strings.

Also also, I forgot to mention that I am using MySQL with MySQL workbench.

I'm asking for any guidance, I could probably be at least sent to some resources that are more targeted to my needs. To some extent, I don't know even what to search, I don't know what best practices are, like if a few thousand variables is better or worse than 128 arrays for performance, etc...

addl info: assuming I don't know anything and my approach is wrong, my end goal is to push to my javascript something like:

Var Content00101 = a (first alphabetical group, first alphabetical among most popular)

Var content 00302 = by (third alphabetical group, second alphabetical among most popular)

Any efficient way to do this is good by me

  • 1
    You have a practice in some upper-level programming language? Do not transfer this ideology to SQL. Forget about iterative processing - DBMS uses another data processing principles. Partial processing may increase processing time (and should with high probability) and cannot decrease it. Please post the task itself, not a way which you imagine. – Akina Oct 9 at 4:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.