Beginner

709. CREATE TABLE

Learn how to create a table with columns, data types, and constraints.

📘 Lesson 708 of 728 ⏱ 8 min 🎯 Beginner

CREATE TABLE is a DDL command used to create a new table inside a database. During table creation, each column is assigned a name, data type, and optional constraints such as PRIMARY KEY or NOT NULL.

Tables are where business data is actually stored. Every SQL application relies on properly designed tables.

An HR application creates an Employees table containing EmployeeID, EmployeeName, Department, Salary, and JoiningDate.

SQL
CREATE TABLE Employees
(
    EmployeeID INT PRIMARY KEY,
    EmployeeName VARCHAR(100),
    Department VARCHAR(50),
    Salary DECIMAL(10,2)
);

Organizations create tables for customers, orders, employees, products, invoices, payments, inventory, and many other business entities.

  • Creates a new table.
  • Columns require data types.
  • Supports constraints.
  • Table names should be meaningful.
  • Each table stores related information.
  • One database can contain many tables.
  • It is a DDL command.
Which SQL statement creates a table?

CREATE TABLE creates a new table inside a database.

Why are data types important?

Data types define what kind of values a column can store.

Have you finished this lesson?

Introduction to SQL – All Lessons