Flash Sale:75% Off Hosting + Free DomainEnds in13h47m14sView Plans
Hostvento logoHostvento

How to create a table in phpMyAdmin

This guide shows you how to build a new table inside a MySQL database, step by step.

Databases2 min read14 steps

What is a table?

A database is like a filing cabinet. A table is a drawer in it. A table looks like a spreadsheet. It has columns, which are the headings, and rows, which are the entries. For example, a "friends" table could have the columns name, phone and birthday. Each friend is one row.

phpMyAdmin is a web tool for managing databases. You can open it from cPanel, the control panel for your hosting.

Steps

  1. Log in to your client area. Open your hosting service and log in to cPanel.
  2. Under Databases, click phpMyAdmin.
  3. Click your database name on the left. If you have none, create one first in MySQL Databases.
  4. Find the Create table box.
  5. Type a table name, for example friends.
  6. Type the number of columns you need, for example 3.
  7. Click Go (or Create).
  8. Fill in one line for each column:
    • Name: the column heading, like name.
    • Type: the kind of data. Use INT for whole numbers, VARCHAR for short text, TEXT for long text, and DATE for dates.
    • Length/Values: the maximum size. For VARCHAR, type a number like 100.
  9. Make an ID column. Set its type to INT. Under Index, choose PRIMARY. Tick A_I, which means auto increment. Now each row gets its own number by itself.
  10. Click Save.

The new table now shows in the left list.

Add a row

  1. Click your table name.
  2. Click the Insert tab.
  3. Type values into the boxes. Skip the ID, because it fills in itself.
  4. Click Go.

Create with SQL

You can also use the SQL tab:

CREATE TABLE friends (
  id INT AUTO_INCREMENT PRIMARY KEY,
  name VARCHAR(100),
  phone VARCHAR(20)
);

This makes a table named friends with three columns.

Tip: Use lowercase names without spaces. Use underscores instead, like first_name.

Quick recap

  • A table holds data in rows and columns.
  • Choose your database, then use the Create table box.
  • Set a name and a type for every column.
  • Give each table an ID column with PRIMARY and A_I.
  • Click Save.