An RDBMS is database software that stores data in structured two-dimensional tables consisting of rows and columns. Tables connect to each other using key relationships.
Relational databases eliminate data duplication by normalizing schemas and establishing relationships through Primary Keys and Foreign Keys.
erDiagram
USERS ||--o{ ORDERS : places
USERS {
int id PK
string name
string email
}
ORDERS {
int id PK
int user_id FK
decimal total_amount
}
customers, orders).email, price).-- Create parent table
CREATE TABLE departments (
id INT AUTO_INCREMENT PRIMARY KEY,
department_name VARCHAR(100) NOT NULL
);
-- Create child table linked by Foreign Key
CREATE TABLE employees (
id INT AUTO_INCREMENT PRIMARY KEY,
full_name VARCHAR(100) NOT NULL,
department_id INT,
FOREIGN KEY (department_id) REFERENCES departments(id)
);
Explain how a Foreign Key in a child table maintains relational integrity with a parent table.
Sign in to track your learning journey, earn industry-recognized certificates, and join our elite developer community.
Quick Access With