In short
A database is an organised place to store your app data so you can reliably save it, find it, change it and delete it. When a user signs up, posts a comment, or makes a purchase, that information has to live somewhere that survives after the page reloads, and that somewhere is a database. Unlike a single spreadsheet, a database is built to stay fast and consistent even with millions of records and many users at once.
Tables, rows and columns
The most common way to picture a database is like a set of spreadsheets. Each table holds one kind of thing (users, orders, comments). Each row is one record, and each column is a field on that record, like name or email. The database keeps these organised and lets you query them quickly.
SQL vs NoSQL
There are two broad families. SQL databases store data in strict tables with defined columns and are great when your data has a clear shape. NoSQL databases are more flexible about structure and are handy when your data varies. For most apps either works; the choice matters less than getting the basics of saving and reading data right.
Soft deletes: a habit worth knowing
In real products you usually do not erase data permanently the moment a user deletes something. Instead you mark it as deleted but keep the row, which is called a soft delete. That way data can be recovered and your history stays intact, which protects you from costly mistakes.
Common beginner confusions
A database is not the same as your code, and it is not the same as a backup. Your code reads from and writes to the database, but the data lives separately and survives even when you redeploy your app. People also assume they must run and maintain a database server themselves, which used to be true and is now mostly optional: modern platforms host the database for you, handle backups, and let your AI agent define the structure in code. Finally, you do not query a database by clicking around. You ask it questions with queries, and most modern tools generate those queries for you, so you can model and use real data long before you learn the query language yourself.
