Skip to content · ⁨ข้ามไปยังเนื้อหา⁩
English

Two kinds of SQL command

SQL has two halves:

  • DDL (Data Definition Language) changes the structure — the tables themselves.
  • DML (Data Manipulation Language) works with the data inside the tables — reading it with SELECT, and adding, changing, or removing it with INSERT/UPDATE/DELETE. Everything so far (SELECT) is DML.

CREATE TABLE is the main DDL command. It lists each column with a data type and marks the primary key:

ไทย

คำสั่ง SQL สองประเภท

SQL มีสองส่วน:

  • DDL (Data Definition Language) เปลี่ยน โครงสร้าง — ตัวตารางเอง
  • DML (Data Manipulation Language) ทำงานกับ ข้อมูล ภายในตาราง — อ่านข้อมูลด้วย SELECT และเพิ่ม เปลี่ยน หรือลบด้วย INSERT/UPDATE/DELETE ทุกสิ่งที่ผ่านมา (SELECT) คือ DML

CREATE TABLE เป็นคำสั่ง DDL หลัก แสดงรายการคอลัมน์พร้อม data type และกำหนด primary key

CREATE TABLE customer (
  id   INTEGER PRIMARY KEY,
  name VARCHAR(20),
  city VARCHAR(15)
);

CREATE TABLE กำหนดคอลัมน์และสร้างตารางว่าง

Handout · ⁨เอกสารประกอบการเรียน⁩

Log in or create account · ⁨เข้าสู่ระบบหรือสร้างบัญชี⁩

IGCSE, A-Level & AP