You recently asked a similar question. Have you thought about taking some of the free training offered here.
But things like grand totals and summaries are separate queries. And line items are done in the query, I gave a short example in the other post of sum.
Edit:
This site has excellent sql tutorials and example: https://www.mysqltutorial.org/mysql-sum/