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コマンドの2種類

SQLには2つの部分があります:

  • DDL (Data Definition Language) は構造——すなわちテーブルそのもの——を変更します。
  • DML (Data Manipulation Language) はテーブル内のデータを操作します。SELECT で読み出し、INSERT/UPDATE/DELETE で追加・変更・削除を行います。これまでに見たすべて(SELECT)は DML です。

CREATE TABLE は主要な DDL コマンドです。各カラムをデータ型で指定し、主鍵をマークします:

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