BeginnerCoder

Lesson 1 — Create a table

Tables, rows and columns

A database stores data in tables. A table is like a spreadsheet: each column has a name and a type (INTEGER for whole numbers, TEXT for words, REAL for decimals), and each row is one record. SQL (Structured Query Language) is the language you use to talk to databases. CREATE TABLE makes a new, empty table.

CREATE TABLE pets (id INTEGER, name TEXT)

These lessons run a real SQLite database inside Python (the built-in sqlite3 module), all in your browser. db.execute(sql) sends one SQL statement to the database.

Why it matters: almost every app — shops, banks, games — keeps its data in tables like this.

Want it another way?
Task

Write the CREATE TABLE statement for a users table with columns id INTEGER, name TEXT and age INTEGER.

Run your code — when the output matches the task, you will see a green check. Then mark the lesson complete.

Next →
Test your knowledge

A quick 3-question quiz on this lesson — instant feedback.

Enjoying this lesson? Share it.