Creating, altering, and dropping tables
Now that we know a little about how data is structured in a database, we can learn more about creating our own tables, making changes to them, and even how to delete them.
Using CREATE TABLE
We use the CREATE TABLE
command to create tables. For a basic database for an online store, we might have tables for customers, products, orders, product reviews, customer addresses, and more. We can create as many tables as we need, but as mentioned previously, we should give the design some thought so that we don't store duplicate or unused data. That said, don't worry about this too much, as we can always make changes later with the ALTER TABLE
command (see the Using ALTER TABLE section later in this chapter).
Using ...
Get Getting Started with MariaDB - Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.