PHPMyAdmin: Creating Table Using The UI

This entry is part 1 of 2 in the series PHPMyAdmin

In PHPMyAdmin, it actually provides a UI for us to create a table.

Let’s try to create a table with 3 columns.

But before we can have a table, we would need to create a database first.

1. In PHPMyAdmin, click on NEW in the left panel


2. Give the database a name, for now we call it Artist.  Enter Artist in the textbox under Create Database.

3. Click on create to create the database Artist.

4. Now that we have the Artist database create, click on it on the left panel and we would have a screenshot as below.



6.  We can now create the table.  Let’s create a table called Album with 3 columns.

7.  The 3 columns are for Name, Title and Year.

8.  Enter Album for Name and 3 for Number of Columns as shown in the screenshot above.

9.  Click on Go.

10.  After click Go, you will see a screenshot as below.



11.  This screenshot is for us to enter the column info.

12.  For Name, we give it a varchar with length 64 chars, Title with 256 chars. For Year, we will use Integer and so length is not needed.


13.  Click on Save to create the table.

14.  Now we have a album table with 3 columns created.



16.  We can insert a record to test it.

17.  Click on SQL on the tab and Insert


18.  An Insert statement will be automatically created for us.

INSERT INTO `album`(`Name`, `Title`, `Year`) VALUES ([value-1],[value-2],[value-3])

19.  We just have to make some changes to this statement to insert a record.

20.  Modify it to below sql insert statement

INSERT INTO `album`(`Name`, `Title`, `Year`) VALUES ('Rod Stewart','Every Picture Tells A Story',1969)

21. A record will be inserted into the table.





Posted in

PHPMyAdmin: Import data using CSV file

This entry is part 2 of 2 in the series PHPMyAdmin

In our previous post, we have created table and inserted a record using the statement below:

INSERT INTO `album`(`Name`, `Title`, `Year`) VALUES ('Rod Stewart','Every Picture Tells A Story',1969)

This is a 3 column table and it is ok to use an sql statement if we need only to insert a few records.

Say we have  1000 records and they are all in a file.  We would have to import them by using PHPMyAdmin.

I used to work with Sybase or Oracle and normally, I would import them using bcp or bulk copy through the command line.



To import them using PHPMyAdmin, you can prepare a CSV file using MS Excel.  This can be done easily by saving the file as CSV file in MS Excel.

In the PHPMyAdmin, as shown in the screenshot above, click on Choose File and select the CSV file.


In the format of the file, we need to select CSV and click on GO.

The 3 records will be appended into the album table.