Creating tables
Now the connection starts becoming useful.
A table is where the actual structured records live inside a database. The database is the container, and the table is one of the places where your data is organized into columns and rows. So at this point, you are moving from “can PHP reach MySQL?” into “can PHP define a data structure inside the database?”
The SQL command here is CREATE TABLE .... Inside it, you describe the columns and the rules for each one. That is the important shift in this lesson: you are not inserting real data yet, you are defining what kind of data the table will be allowed to store.
Some of the column rules matter a lot. PRIMARY KEY means that column uniquely identifies each row. AUTO_INCREMENT means MySQL will generate the next numeric ID for you automatically. NOT NULL means that field is required. DEFAULT means MySQL will use a fallback value if you do not provide one yourself.
The example also introduces data types more concretely. INT is for whole numbers, VARCHAR is for short text, and TIMESTAMP is for date/time values managed by MySQL. You do not need to memorize every type right now, just get used to the idea that each column needs both a type and, sometimes, extra rules.
One practical thing to notice is that creating a table happens inside an existing database, unlike the previous lesson where you connected without choosing a database first. Here you do need to connect to a specific database, because the table has to be created somewhere.
So the useful mental model is: first connect to the right database, then send one CREATE TABLE query that describes the shape of the records you want to store.