beginner
Introduction to Databases & SQL
8 min readLast updated: 2026-07-05
Overview
SQL (Structured Query Language) is the standard language for querying, updating, and managing relational database management systems (RDBMS).
Learning Objectives
- Define Relational Database Systems (RDBMS).
- Identify differences between DDL (Data Definition) and DML (Data Manipulation).
- Learn basic database table structure models.
Detailed Concept Explanation
Relational databases store records inside rows and columns linked by primary and foreign keys. SQL commands are split into:
- DDL:
CREATE,ALTER,DROP(defines schemas). - DML:
SELECT,INSERT,UPDATE,DELETE(queries/modifies rows).
Code Examples
SQL
sql
-- DDL statement
CREATE TABLE users (
id INTEGER PRIMARY KEY,
username TEXT NOT NULL,
joined_date DATE
);
-- DML statement
INSERT INTO users VALUES (1, 'developer', '2026-07-05');
Execution Plan Diagram
CREATE TABLE schema
INSERT INTO user row
Save schema details
Best Practices
- Consistent Casings: Keep SQL keywords in UPPERCASE (
SELECT,FROM) and schema tables/columns in lowercase. - Constraints Setting: Always enforce logical constraints (
NOT NULL,UNIQUE) on key identification columns.
Interview Perspective
Note
Interview Question: What is the difference between DDL and DML in SQL?
DDL (Data Definition Language) commands modify the schema structure itself (e.g. adding columns, dropping tables). DML (Data Manipulation Language) commands modify the data values within those tables (e.g. updating values, querying rows).
Interactive Challenges
Summary
Relational databases store structured rows, which are queried using DML commands (like SELECT) and managed using DDL commands (like CREATE).