Home › coding › sql › sql ddl

Sql Ddl — Free Sql Tutorial

Learn Sql Ddl in Sql with a free, beginner-friendly tutorial, examples and practice for Indian students on Syllab.in.

✓ 100% Free ✓ No Login Needed ✓ NCERT / CBSE Aligned ✓ Download as PDF

TL;DR: Learn Sql Ddl in Sql with a free, beginner-friendly tutorial, examples and practice for Indian students on Syllab.in.

Written & reviewed by the Syllab.in Academic Team (CBSE/NCERT subject experts) · Updated Jul 14, 2026

🤖 Stuck on any question? Ask Syllab's free AI Tutor for a step-by-step explanation — instant, unlimited, no login.

Sql Ddl in Sql

DDL (Data Definition Language) is the SQL commands that define the structure of a database: CREATE TABLE, ALTER TABLE, DROP TABLE. Understanding DDL is essential for designing databases from scratch.

Constraints: Rules that enforce data integrity. PRIMARY KEY: uniquely identifies each row, cannot be NULL or duplicate. NOT NULL: column must always have a value. UNIQUE: no duplicates allowed (but can be NULL). DEFAULT: value used if none is specified. CHECK: value must meet a condition. FOREIGN KEY: links to another table's primary key.

Good database design uses constraints to prevent bad data from entering the database — better to reject bad input at the database level than to deal with corrupted data later.

Sql Ddl — Syntax

CREATE TABLE table_name (
  column1 datatype CONSTRAINT,
  column2 datatype CONSTRAINT,
  PRIMARY KEY (column1),
  FOREIGN KEY (column2) REFERENCES other_table(pk)
);

-- Data types: INT, VARCHAR(n), DECIMAL(p,s),
-- DATE, BOOLEAN, TEXT

Learn Sql Ddl step by step with Syllab's free interactive Sql tutorial — runnable code examples, practice exercises and instant AI feedback, all free with no signup. Explore the full Sql course →

Explore:

  • Syllabus
  • Practice
  • Mock Tests
  • NCERT Solutions
  • Coding
  • GK Quiz
  • Career Predictor
  • AI Tutor
  • Live Quiz
  • Doubt Solver
  • Microlearning
  • Free Alternatives
  • Kids Zone
  • Study Room
  • Calculators
  • Worksheets

Syllab.in — Free learning for Indian students, Class 1–12