Earlier in this lesson we mentioned that SQL databases have a strict schema.
A schema is the structure of your database — it defines:
- What tables exist
- What columns each table has
- What types each column uses (like numbers, text, dates)
- What relationships exist between tables (like foreign keys - more on these in a future lesson)
For example, if you create this table:
CREATE TABLE users (
id INT PRIMARY KEY AUTO_INCREMENT,
username VARCHAR(100),
email VARCHAR(255)
);
You’ve just defined part of your database schema.
In SQL, the schema is strict — if your table says a column must be a number, you can’t insert text.