Creating a Table Print

  • databasesphpmyadmin, databases, database, phpmyadmin, troubleshooting, backup, migration, guide
  • 0

When you need somewhere to put data.

WHEN

A custom feature storing its own data An import needing a destination A working copy for an operation

For application data, let the application create its tables.

IN PHPMYADMIN

Select the database, then the Create table form at the bottom of the structure list.

Specify the name and the number of columns, then define each: name, type, length, whether it allows NULL, and any default.

WHAT EVERY TABLE SHOULD HAVE

A primary key, usually an id column set to INT, AUTO_INCREMENT, and marked as the primary key.

Without one, individual rows are awkward to reference and phpMyAdmin cannot edit them reliably.

THE ENGINE

InnoDB. Set it explicitly rather than relying on the default.

THE CHARACTER SET

utf8mb4 with a matching collation, so it handles every character including emoji.

A table created with a different character set from the rest of the database causes problems in joins and comparisons.

NAMING

Use the same prefix as your application's tables if it belongs with them, so backups and migrations include it.


Was this answer helpful?
Back

Are you happy with your experience? Leave us a review on Trustpilot.


Trustpilot