SQL mental model: SQL is a table transformation language
Instead of thinking of SQL as a programming language like Java or PHP, think of it as a language that lets you use various “clauses” like SELECT, WHERE or GROUP BY to specify the series of transformations you want to apply to a base table.
You begin with a base table and then every clause you specify like WHERE will create a new virtual table and pass that virtual table to the next clause, which applies its own transformation to create yet another virtual table. The order in which these clauses are executed is called the logical processing order.
Once all the clauses are executed, you end up with your desired table. So SQL is essentially a language that lets you perform a series of transformations to get data from one or more tables into a final table with the desired structure. You can then do whatever you want with that data such as show it to users in a web application.