How can traverse data from database into wordpress site

Hwy everyone I am new to programming and have basic skills of HTML and CSS and basic enough understanding of JavaScript to get the job done.

I have this tool on my WordPress based website I want to add a feature in this and other similar tools in which it stores the top scores in database and traverse it on every refresh,
I first tried to store tops scores in variables but they wipe out after refresh cz of volatile memory, as per my recent understanding I have to setup a table in database and traverse data from it.
Can you guys first correct me if I am on the right path and suggest me a good resource or a wordpress plugin to make this possible for me thanks.

One more thing I am scared of using APIs, so if you guys can suggest me an easy way to create and connect to database from my wordpress front end.
P.S. I have just began learning basic programming.