We use cookies to enhance your experience on the site
CodeWorlds

Table Workshop - welcome to the scriptorium!

Welcome back, @name! This time we descend into the scriptorium - the heart of the Library, where new shelves are made. So far you have learned to read scrolls. Today I will teach you to build the shelves themselves - that is, tables.

From reading to creating

The commands you learned earlier (SELECT, WHERE, ORDER BY) were used to retrieve data. They belong to a group called DML (Data Manipulation Language). Now we enter the world of DDL (Data Definition Language) - the language with which we define the structure of the Library.

DDL lets us:

  • create new shelves (CREATE TABLE),
  • rebuild existing shelves (ALTER TABLE),
  • drop entire shelves (DROP TABLE).

What is a table as a construction?

Think of a shelf you are only just designing. Before you place a single scroll on it, you must decide:

  • how many fields (columns) it will have,
  • what kind of data will go into each field (types),
  • what rules they must meet (constraints).

That is exactly what CREATE TABLE does - it draws the plan of the shelf before any data appears on it.

Plan of this location

In the scriptorium you will learn to:

  1. create tables with CREATE TABLE,
  2. choose data types (INT, VARCHAR, DATE, DECIMAL, ENUM...),
  3. give columns constraints (PRIMARY KEY, NOT NULL, DEFAULT, UNIQUE...),
  4. rebuild tables with ALTER TABLE,
  5. remove them with DROP TABLE.

Grab a chisel and stylus, scribe - we will build your first shelf!

Go to CodeWorlds