We use cookies to enhance your experience on the site
CodeWorlds

Tables, rows and columns

Before we give the Library its first order, we must understand its structure well. Remember these three words - they will accompany you throughout your journey.

Table

A table is a single shelf - a collection of data of one kind. In our Library we will use several shelves:

  • ksiazki
    - all books,
  • autorzy
    - the creators of the books,
  • czytelnicy
    - people enrolled in the Library,
  • kategorie
    - thematic sections,
  • wypozyczenia
    - who borrowed which book and when.

Row (record)

A row is a single scroll - one entry in a table. One row in

czytelnicy
describes one person:

| id | imie | nazwisko | miasto | |----|------|----------|--------| | 7 | Hypatia | of Alexandria | Alexandria |

Column (field)

A column is a single field describing all rows. In

czytelnicy
we have the columns
id
,
imie
,
nazwisko
,
miasto
. Each column has its type - e.g. text or number (more on types in the "Table Workshop" location).

Primary key (PRIMARY KEY)

Every shelf has its register of catalog numbers - a column that uniquely identifies each row. This is the primary key, most often the

id
column.

Thanks to the primary key:

  • no two rows share the same catalog number,
  • we can point to a specific scroll among thousands without mistake.

This is exactly the idea behind my Pinakes - a catalog that gives every scroll a unique number.

Go to CodeWorlds