In this tutorial, I will show you how to create database and table directly using phpmyadmin.
Creating database using below steps:
- You can click on “Databases” button present at the top or “New” link present at extream left the side, with a tree view of databases.
- After clicking on “creating database” button you will see “Create database” section with one text box and drop down menu. Enter database name say “company_db” in the text box and click on “Create” button.
This will add new database “company_db” in the database list.
Creating table:
Follow below steps to create table inside database “company_db“.
- If you want to create database table inside “employees_db” database, you first need to select that database. Click on “company_db” database link. Doing this, the page will get refreshed and you will see at the top of the page, breadcrumb gets updated to : “Server: MySQL wamp server »Database: company_db”. This indicates that you have selected your database.
- Now you will see “Create table” section with two text boxes “Name” for the name of the table and “Number of columns” for the count of columns your table will contain. Enter table name “employee” as table name and column count as “4” and click on “Go” button. This will show below page with the fields for table columns.
- Create columns by giving them name and datatype. Enter “id” as first column name and “Type” as “INT”. Enter 11 as Lenght/Values. Click on “Index” drop-down and select “PRIMARY” to make this as a primary key column. Select “A_I” checkbox to make it auto increment.
- Enter “empname”, “username” and “password” as other columns. Select “VARCHAR” as type and 150 as Lenght for all these columns.
- Click on save.
You will see that new table “employees” has been added to the database. Clicking on table name will show the empty result set as there is no record created yet.
In next lesson, we will see how to connect database with PHP and see different operations using PHP on database tables.