What is a relational database?
BeginnerConceptMySQL
Answer
Short answer
A relational database stores data in tables made of rows and columns, and links tables together using keys. You read and change the data with SQL. MySQL, PostgreSQL, SQL Server and Oracle are all relational databases.
Explained in simple words
Think of a set of Excel sheets that reference each other: a customers sheet and an orders sheet, where each order row has a customer_id pointing at a customer row. The database makes sure those references stay correct.
Example
customers orders
+----+-------+-------+ +----+-------------+--------+
| id | name | city | | id | customer_id | total |
+----+-------+-------+ +----+-------------+--------+
| 1 | Asha | Pune |◀────────| 7 | 1 | 52000 |
| 2 | Ravi | Delhi | | 8 | 2 | 1499 |
+----+-------+-------+ +----+-------------+--------+
Key properties
- Schema — every table has defined columns and types.
- Relationships — primary keys and foreign keys connect tables.
- ACID transactions — changes are all-or-nothing and consistent.
- SQL — one standard language to query everything.
What to say in the interview
"A relational database stores data in tables with a fixed schema and links them with primary and foreign keys. It supports SQL and ACID transactions, which is why it's used for orders, payments and user accounts."
More on MySQL
How do you set up MySQL and log in to it?BeginnerHow do you create a database, a table and see data in MySQL?BeginnerHow do you create a MySQL user for an application and give it permissions?BeginnerHow do you back up and restore a MySQL database?BeginnerWhat is the difference between a database, a table, a row and a column?BeginnerHow do you check whether MySQL is running and which port it listens on?Beginner