Wishing you all a happy and prosperous New year 2019!
First question is why query? Lets see the advantage of queries.
Below is the article which gives step wise procedure how to fetch data using a query and how to link it to a part page
Microsoft Dynamics NAV 2017