In this tutorial, we’ll show you how to create a database table with phpMyAdmin. We’ll assume that you are already logged into phpMyAdmin. If you are not logged in just follow the steps in this tutorial to login.
1) First, we’ll need to select the database, in this example, we’ll use the ultahost_demo database.
2) You’ll notice that we have a couple of test tables already created, to create a new database table just enter the name of the table in the “Name” field and the number of fields you want for this table and click “Go”.
3) We’ve created the table “demo” and added two columns (name and phone), now we need to set the details of each field within this new table and select Type of data the column will hold. Some of the most common types are:
- INT = INTEGER – used to store a number that can be written without a fractional component. (e.g. 2, 10, -44). An integer can be zero, positive, and negative.
- CHAR = Characters – used to store character string value of fixed length, the maximum number is of characters is 255.
- VARCHAR = Variable Length Characters – used to store variable length alphanumeric data and can store up to 65,535 characters.
- TEXT = used for holding large amounts of text.
- DATE = Will only hold dates.
- DATETIME = Will hold both a date and a time.
4) We can also define the Length/Values if necessary, the CHAR type will require you to specify the maximum number of characters allowed. All the other fields are optional, however, if you need more detailed information about all the options available you can check the MySQL Reference Manual.
5) When finished, click “Save”. A message will appear indicating that your table has been created.