A3.3.1 Outline the differences between data language types within SQL.

A3.3.1 Outline the differences between data language types within SQL. 
• Data language types must include data definition language (DDL) and data manipulation language (DML) 
• SQL statements to define data structures or to manipulate data

📚 You can find additional information related to these learning standards in the course companion pages 191 to 195

The Big Idea

Structured Query Language (SQL) is the standard language for managing relational databases. Within SQL, there are subsets of commands designed for different tasks. Two of the most fundamental subsets are:

  • Data Definition Language (DDL): used to define and modify the structure of database objects (tables, schemas, indexes, etc.).
  • Data Manipulation Language (DML): used to manipulate the data inside those objects (inserting, updating, deleting, querying rows).

Each serves a distinct purpose in the lifecycle of a relational database system.


1. Data Definition Language (DDL)

Purpose

Defines, alters, or removes schema-level structures.

Common DDL Statements

CommandDescription
CREATECreates new database objects like tables, views, indexes
ALTERModifies an existing object (add/remove columns, constraints)
DROPPermanently deletes objects from the schema
TRUNCATEDeletes all data from a table but keeps the structure

Example – Create a table

CREATE TABLE students (
    student_id INT PRIMARY KEY,
    name VARCHAR(100),
    birth_date DATE
);

Example – Add a column

ALTER TABLE students ADD COLUMN email VARCHAR(255);

2. Data Manipulation Language (DML)

Purpose

Performs actions on the data itself, inside the objects defined using DDL.

Common DML Statements

CommandDescription
SELECTRetrieves data from tables
INSERTAdds new rows
UPDATEModifies existing rows
DELETERemoves rows

Example – Insert a record

INSERT INTO students (student_id, name, birth_date)
VALUES (101, 'Alice Smith', '2006-11-15');

Example – Retrieve records

SELECT name, birth_date FROM students WHERE student_id = 101;

Summary Table

CategoryDDL (Data Definition Language)DML (Data Manipulation Language)
FocusStructure/schemaData/rows
ExamplesCREATE, ALTER, DROP, TRUNCATESELECT, INSERT, UPDATE, DELETE
Use CaseCreate or modify a tableAdd, change, remove, or query data in a table
PersistenceUsually auto-committed and affects structure permanentlyMay require explicit transaction control (e.g., COMMIT)

Conclusion

In SQL, DDL defines the "shape" of the database, while DML populates and modifies its contents. Understanding the difference is foundational to effective database development: DDL builds the house, DML moves the furniture. Both are essential in the design, implementation, and operation of relational database systems.