Skip to content · ⁨Saltar al contenido⁩

Creating tables · ⁨Creación de tablas⁩

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:

Español

Dos tipos de comandos SQL

SQL tiene dos mitades:

  • DDL (Data Definition Language) cambia la estructura — las propias tablas.
  • DML (Data Manipulation Language) trabaja con los datos dentro de las tablas: leyéndolos con SELECT, y agregando, modificando o eliminándolos con INSERT/UPDATE/DELETE. Todo lo visto hasta ahora (SELECT) es DML.

CREATE TABLE es el comando principal de DDL. Enumera cada columna con un tipo de dato y marca la clave primaria:

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

CREATE TABLE define las columnas y crea una tabla vacía

Handout · ⁨Material⁩

Log in or create account · ⁨Iniciar sesión o crear cuenta⁩

IGCSE, A-Level & AP