Query: A request for data from a database or API. In SQL, a query is written in a SELECT statement; in GraphQL, a query is the operation that fetches data. A query is a request for data. In SQL it is usually a SELECT statement that describes which rows and columns you want; in GraphQL it is an operation that fetches specific fields; in a search engine it is the text you type.
In web applications, queries are often the biggest factor in performance. A page that runs 200 small queries, or one query without a suitable index, can be slow no matter how fast the server is.
What should you keep in mind with Query?
A few habits help. Select only the columns you need, add indexes for the columns you filter and sort on, and avoid queries inside loops. Use your framework's debugging tools to see which queries a page runs. And always pass user input as parameters, never by building SQL strings yourself, which is the classic route to SQL injection.