MySQL RDBMS
In this page:
What is a Relational Database?
A relational database organizes data into structured tables made up of rows and columns, and a relational database management system, or RDBMS, is the software that creates, stores, and lets you query those tables using SQL.
Example: What is a Relational Database?
CREATE TABLE users (id INT PRIMARY KEY, name VARCHAR(50));
SELECT * FROM users;
Tables, Rows, and Columns
Every table in a relational database is made up of columns, which define what kind of data can be stored (like a name or an email address), and rows, where each row represents one complete record made up of a value for every column.
Example: Tables, Rows, and Columns
CREATE TABLE contacts (
name VARCHAR(50),
email VARCHAR(100)
);
INSERT INTO contacts VALUES ('Priya', '[email protected]');
Primary Keys and Relationships
A primary key uniquely identifies each row in a table, and a foreign key in one table can reference a primary key in another, which is how a relational database models relationships between different kinds of data, like customers and their orders.
Example: Primary Keys and Relationships
CREATE TABLE authors (id INT PRIMARY KEY, name VARCHAR(50));
CREATE TABLE books (
id INT PRIMARY KEY,
title VARCHAR(100),
author_id INT,
FOREIGN KEY (author_id) REFERENCES authors(id)
);
RDBMS vs Other Database Types
An RDBMS enforces a fixed table structure and strict relationships between tables, which differs from non-relational (NoSQL) databases that often store flexible, schema-less documents without predefined columns or formal relationships.
Example: RDBMS vs Other Database Types
CREATE TABLE orders (
id INT PRIMARY KEY,
customer_id INT NOT NULL,
total DECIMAL(10,2) NOT NULL
);
Popular RDBMS Systems
MySQL is one of several popular RDBMS products alongside PostgreSQL, Microsoft SQL Server, and Oracle Database, and while each implements the same core relational concepts, their exact SQL syntax and available features can differ.
Example: Popular RDBMS Systems
-- MySQL, PostgreSQL, SQL Server, and Oracle all implement core relational concepts
SELECT VERSION();
Chapter Quiz — Complete all 8 topics to unlock
0/8 topics done
Complete these topics first: