Before you can add a table to a MySQL database you first need to create the database itself. However, most hosting companies allow only one database per customer account and therefore you may not have this option. If this is the case, you can add a table to the existing database for your account. For those lucky few, here is the sql statement that you will use to create a new database. For the purpose of this tutorial, I created a new database called calendar. This database will hold the information or data about the activities listed on my calendar.

CREATE DATABASE name_of_new_databaseCREATE DATABASE calendar

Now that we all know what database we will be using and we are all on the same page, we will start to discuss how to add a new table to a database. In this table will be stored that data about the scheduled activities in my calendar database. It is always best to give your tables descriptive names. Letís call this table activities. We will create a table using the following sql statement.

CREATE TABLE activities()

But we also need to supply information about the data to be stored inside this table. For example, since this is a table to hold data about each activity or event on my calendar, we will need to store the name and description for each activity, the time (month, day, year, hour, minute) and the status (completed or incomplete). This information will go inside the parenthesis in the code above.

Let's assign a field, or table cell, to hold each piece of information. The name for each field will start with act_ to identify that it belongs to the activities table. This is a common method of naming table fields.