Creating a database table

Before you can do anything with your Database, you should create a table and set the corresponding fields in it.

Creating a table in PHPMyAdmin is simple. Just type the name, select the number of fields and click the Go button. You will then be taken to a setup screen where you should create the fields for the database.


Alternatively, you can run a MySQL query, which will create the table. The format is:

CREATE TABLE tablename (



The fields are defined as follows:

fieldname type(length) extra info,

The fields are separated by a comma.

For example, if you wish to create a table called Members with 3 fields in it - FirstName, LastName and Age, you should execute the following query:

FirstName varchar(15),
LastName varchar(15),
Age int

More information on how to connect to the database and how to query it can be found in the following tutorials:

  • Connect to the database
  • Query the database
  • Display table data
  • Select individual records
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

How to Use PHP and MySQL

PHP is the most popular scripting language for web development. It is free, open-source and...

How to Select Individual Records

As well as showing the whole Database, PHP can be used to select individual records or records...

How to Connect to Your Database

You should establish a connection to the MySQL database. This is an extremely important step...

Pear Modules

By default all AVHoster servers have the following Pear packages installed: Archive_Tar...


MySQL Export: How to backup your MySQL Database? You can easily create a dump...