Back to list
Lv.2

Query

Query

An instruction that requests a system, such as a database, to search for or manipulate data.

In Simple Terms

A query is a command that asks a system, such as a database, to search for or manipulate specific data. For example, when you search for a friend in a smartphone app, behind the scenes the app sends a query to the database saying "find the user with this name." The keywords you type into an internet search box are also treated as a type of query sent to the search engine.

Behind the Name

The word "query" itself means "a question" or "an inquiry" — it's named this way because sending a query to a database is like asking it, "please give me the data that matches this condition." A handy way to picture it: it's the language a program uses to talk to a database.

Take a Closer Look!

A query is a special command sent to a system, such as a database, to retrieve or modify information.
It lets you instantly pull out exactly what you need from a massive pile of data.

A simple way to picture it: think of it like a note you hand to a librarian saying "please find this book for me."
Queries are often written in SQL, a programming language built for working with databases, and a single query statement can specify exactly which table to pull from, which data to retrieve, and under what conditions.
For example, when you search an online store for "red shoes under ¥1,000," the system turns that condition into a query, asks the database, and displays the list of matching products.

Beyond commands sent to databases, the keywords you type into a search engine like Google are also sometimes called a "search query."
When it comes to retrieving data, a database query matches records against a given condition with exact precision, while a search engine query uses its own algorithm to guess which web pages relate to the words you typed, then ranks and displays them by relevance. Even though both use the word "query," the mechanics running behind the scenes and how they hunt down data are different.