Junior — Middle
Can you explain what a relational database is and how it is structured?
sobes.tech AI
Answer from AI
A relational database is a database management system that stores data in the form of tables (relations). Each table consists of rows and columns, where rows are records and columns are fields with a specific data type.
Main characteristics of a relational database:
- Tables are linked through keys (primary and foreign).
- Primary key uniquely identifies each record in a table.
- Foreign key is used to link tables, pointing to the primary key of another table.
- Data is organized to minimize duplication and ensure integrity.
Example: a Users table with fields id (primary key), name, email and a Orders table with a user_id field (foreign key to id in Users), linking orders to a specific user.
Relational databases use SQL language for creating, reading, updating, and deleting data.