How Applications Use Databases
Where the database sits in a real app, what a "query" is, and why almost every piece of software you use is quietly talking to one.
You now know what a database is and why it exists. Let us see where it lives in the software you use every day — because once you can picture that, SQL stops being abstract and starts being obviously useful.
The app is not the data
When you use an app — a store, a chat, a banking site — there are really two separate things working together:
- The application: the screens, buttons, and logic you interact with.
- The database: the quiet, screen-less system that remembers everything.
The application never stores the real data itself. Every time it needs to remember or retrieve something, it sends a request to the database and uses the answer to build what you see.
What is a "query"?
A query is a request you send to a database, written in SQL. The word sounds technical, but a query is just a precise question or instruction:
- "Give me all messages in this chat, newest first." (a question)
- "Add this new order." (an instruction)
- "Change this user's email." (an instruction)
- "Delete this saved item." (an instruction)
The database reads the query, does the work, and sends back either the requested rows or a confirmation that the change happened.
Queries do more than ask questions
Although "query" sounds like asking, in practice SQL queries also
change data — inserting, updating, and deleting rows. We will
learn the asking kind (SELECT) most deeply, because reading data
well is the foundation for everything else.
A concrete trip through an app
Suppose you open a food-delivery app and tap a restaurant. Here is the conversation happening behind the scenes:
Notice the rhythm: every meaningful action becomes one or more queries. Show a menu? That is a query. Place an order? That is a query. View past orders? Another query. The app is, to a surprising degree, a friendly face on top of a stream of SQL.
Why this matters for you
Understanding this picture changes how you read the rest of the
course. When you learn SELECT ... WHERE, you are learning exactly
how an app fetches "this user's unread messages." When you learn
JOIN, you are learning how an app shows "your orders, with each
restaurant's name attached." You are not learning trivia — you are
learning the language that powers the software world.
Check your understanding
In a typical app, where does the real, long-lived data actually live?
Inside the buttons and screens of the application itself.
In the database, which the application queries whenever it needs to store or retrieve information.
Only in the user's memory.
Nowhere — apps recalculate everything each time.
What is a SQL query, in plain terms?
A type of button inside an application.
A backup copy of the database.
A precise request — a question or an instruction — sent to the database, written in SQL.
The physical disk where data is stored.
Spreadsheets vs. Databases
Why spreadsheets are wonderful — until they aren't — and the specific moments when a relational database becomes the right tool.
Why SQL Exists
Why we ask databases questions in a special language called SQL, what makes it "declarative," and why one language works across so many database systems.