First thing, you want to check out the Bohemia Interactive Wiki website for script questions. Random wiki page: community (dot) bistudio.com/wiki/forEach
What you are asking about are SetVariable, and GetVariable. Some of these values you can manipulate, others you cant.
You will not be able to "query" the database ingame the way you are thinking, at least not in an easy way... From my experience (500 some hours scripting in A2).
Secondarily, you should really ask this question in the Dayz Epoch Discord. People like bombardierz has helped me out a lot in the past. Lots of oldies are still around for fun and will most of the time answer your questions if you ask nice.
Ask yourself if you really need to query the database for the information you are requesting. Perhaps some of the things can be defined client side without such heavy operations , like player user ID ,etc. Thats really easy and nothing you'll need an external query for.
For example :
local _playerPUID = getPlayerUID player;'
This one line of code defines the variable and gets the information in one go,s o you dont need to declare it. Its pretty cool.
Best of luck to you.