Friday 9 January 2015

STEPS WITH PICTURES ON HOW TO CREATE A DATABASE AND TABLE IN PHPMYADMIN

Login to your phpmyadmin.

There are horizontal tabs at the top of the phpmyadmin page. Database is the first tab from the left side of your screen, click on the database.















The new page that will appear will be similar to the one in the image below, insert the name of your database in the text box indicated in the image below.









After you have written the name of your database, click on the create button to the right of the text box you write your database name.









You have now created your database. Let’s assume that the name of the database you just create is mydata. The database name will appear in the list of databases on the very page you use to create it.















Click on the name of the database you just create.  A page similar to the one below will appear.









Now we are going to create a table. Insert the name of your table and its number of columns in the textboxes accordingly. Let’s say we want to create a table that will contain customers name, email, and address. By looking at the image below, you will see that the table name is customers and the number of columns is 4. You can give the table any name of your choice, but it should be meaningful. You may be wondering why do we put 4 in the column field while we only need three field to accommodate name, email and address, we put the column number to be 4 because we want our table to have an id. You can create a table without an id, id is useful when creating tables like that of users, customers etc. You also don’t have to interact with the id field when inserting data from your CGI script, since ids are always set to AUTO_INCREMENT.











Now click Go.









A page similar to the one below will appear.














Now you give name to your fields in the text boxes below Name, You also use the select boxes to the right of the text boxes you write your field names to select the data type you want your fields to hold. The Length/Values text boxes are where you will give the length of your fields, for instance if you want your field to contain only 10 characters, you have to insert 10 in its length/Values text box. In the image below, you will notice that we have filled all the fields accordingly. The names of our 4 fields are id, name, email and address. The id type is INT because it will hold numbers, the remaining fields all have their types as VARCHAR, by setting the type of these fields to be VARCHAR they can contain combination of characters both numbers and alphabets. The field lengths are also set according to my estimate. You will also notice that I check the id field check box below A_I, this is necessary to make the id field AUTO_INCREMENT.













Click save












Work Done! You have now create your table, and a page with the table name, similar to the one below will appear.

No comments:

Post a Comment