If you just created the new database intsql click on that name on the left of PHPMyAdminThe empty table now.  If you could not create it click on the name of the database you do have.

Naming tip

If you do not have the power to create databases you can end up with a lot of tables and sometimes too many to remember.  You might also have two sites which use tables which you want to have the same name but you can't.  To help with this problem name tables to keep related tables organised.  Instead of using a name like product for  example use the name intsql_product.  That way all the related tables will be sorted together on the left of PHPMyAdmin and it is also much less likely that you will accidentally use the wrong table.

If you have not been able to create a new database add the bit before the underscore to all table names from now on. 

Even if you are able to create databases there is a very good argument for using this naming method because that allows you to later on move or copy the tables to another database server where you are not able to create new databases.

Creating the tables

If you just created a new database you will be told there are no tables and you should see a form ready to create one as shown in the screen shot.  If you already have tables they will be listed and below them is the form to create new ones.

Put the name firsttable in that form field and make the number of columns 5.  Press the Go button.  You now have a form to fill in but before you do look towards the bottom for a drop down labelled Storage Engine.  This is the choice of code/program which will run the database for you.  If it is not InnoDB change it to that.  InnoDB can handle some things we will use later.  If you cannot choose InnoDB then you might need to look for a different server or contact the hosting company and ask why it is missing.

The form you have to fill in has a number of entries repeated five times:

  1. the name of the field
  2. the type of data (numbers, text etc.)
  3. the length or size limit for that data
  4. if you want a default bit of data to be put in you choose it next
  5. you can set the collation different for a field if it will hold a different type of language
  6. of the attributes only one is used a lot (unsigned for numeric data which cannot be negative)

The rest you can ignore for now and may be very different on different versions of PHPMyAdmin. 

Creating the first table

Creating the table fields

In the five rows fill in this data to the Name, Type and Length/Values fields leaving the rest blank for now:

  • cdReference, INT (leave Length empty)
  • cdTitle, VARCHAR, 50
  • cdArtist, VARCHAR, 50
  • cdPrice, DECIMAL, 10,2
  • cdLabel, VARCHAR, 25

Do not press the Save button yet.  You will be adding some more to it but first check that you understand what you have done so far.  You already met INT and VARCHARDECIMAL is any number with a decimal point and the second value is how many numbers to allow after the decimal point.

Some more things to add to the table (primary keys will be explained soon):

Now Save and you will be taken to a view of your first table.