Question:

What is a database?

A database is where we store the data for a web application. When you log into a website and it remembers your email, when you post a comment and it shows up for other users, or when you search for products and get results, all of that data lives in a database.

The most common type is a relational database, which stores information in tables. Each table has rows and columns, similar to a spreadsheet. For example, a users table might have columns for email, password, and name, with each row representing one user. The database lets you quickly find, update, or delete specific information without searching through everything.

Databases are designed to handle lots of data efficiently and safely. Multiple people can read and write to the same database at once without things getting corrupted. They have built-in features to ensure data doesn’t get lost if something crashes. And they’re optimized to find the information you need fast, even when you have millions of records.

Some of the most popular databases are PostgreSQL, MySQL, SQLite, and MongoDB. PostgreSQL, MySQL, and SQLite are relational databases that use SQL to query data. MongoDB is a document database that stores data differently, more like JSON objects rather than tables.

When you build a web application, you almost always need a database to store user accounts, content, settings, and everything else that needs to persist beyond a single session. The database is separate from your application code and runs as its own service, usually on the same server or a dedicated database server.

The first database I worked with was MySQL when I built my first web application on the LAMP Stack. After that I’ve mostly used Postgres both professionally and on side projects. I worked on a microservice that had a document data model so we used Mongo. And I’ve used SQLite as a dev database on occasion.

You might also like