How to Create Database Table in mysql Database

Spread the love

IHow to Create Database Table in mysql Database: Friends, In the previous article we learned how to create a database in cPanel. When a website has a registration form or profile system, the database on that website plays a very important role in saving all the details of the user.

In today’s article we will learn how to create a table in a database and how to get from that HTML form Insert data table. When data from an HTML form is Submitted to be saved in the database. Then the data from that HTML form is saved in a mysql database table.

Also Read: Create Welcome page using php with mysqli Database

Also Read: Send Email using php from html Contact Page – Website Design Step 5

If you haven’t read our previous article, you will not understand how to create this database table today, so please read the previous article. Then this step of today’s web design and development session will help you to understand.

What is mysql database table?

The MySQL database table looks like a normal table. But one of the features of this table is that we can easily store all the data in HTML form and PHP code in the right place in the table. MySQL database tables have rows and columns just like a normal table. Where different data is stored in each row and is equal to each row in the column category.

For example – when we create marksheets in Microsoft Excel, when we create subject wise columns and enter students’ names in rows, the same rule applies here.

Student RollStudent NameEnglishHindiMath
01Student 1858065
02Student 2758178
03Student 3827279
mysql database table example like normal table

Why we need mysql database table?

In a word, we need MySQL database table to save the data to you. It is not possible to store data in a database just by creating a database for storing data. For this you need to create a table where it will be stored automatically in a row.

And to make any changes to the data in the future, the table is very much needed to change the correct data. One of the advantages of this MySQL database is, When the data is changed the amount of error is very small or there is no room for error.

How to create mysql database table?

To create MySQL Database table, we must first login to cPanel. After the cPanel is successfully logged in, its interface will look exactly like this. In this we will see the “Database” option.

mysqldatabase How to Create Database Table in mysql Database

To understand correctly, I have hidden the above options. When I click on the plus button again, the hide options will appear again.

Now we need to click on the “phpMyAdmin” option to create a new database table. When we click “phpMyAdmin” a new tab open automatically where “phpMyAdmin Database” automatically login.

phpmyadmin login
phpmyadmin login

Once the database is logged in, we need to click on the database that we created the day before. Clicking on the database will select the database. This will highlight the database and show the option to create a database table on the right side. How to Create Database Table in mysql Database.

Database table create option here
Database table create option here

Now you have to enter the table name in the Create table option and enter the number of columns we will need here. For example– I gave five columns here and named the table “test_table“. Then click on the Go button on the right.

Also Read: How to Create HTML Contact Page -Website Design Step 4

Now we need to specify what kind of data will be stored in each column of the table and the name of the column. Below is the photocopy.

table setup
table setup

The name here is the name of each column – Like id, name, mobileno, email, address.

These type are the types of data to be stored in each column – Like

  • Name id – Type INT (Type INT means only integer number will be stored in this cell for example 12345…. etc.) “This ID is ticked to the right of the “AI” in the cell. This means that this ID number will be automatically incremented.
  • name, mobileno, email, address – Here type VARCHAR in this column all kinds that can be stored Number , special character, Alphabet etc.
  • Length/Values – In this cell we have to specify how many characters will be stored in each cell. You can see the image above to understand it better. (As you can see in the picture, the ID number is not given any value in the cell because the integer number cannot take more than 11 so this cell is left empty when we save it from the table it will automatically take the 11 number.)

Now we will save from the table by clicking the save button on the bottom right side of the table. After saving, the name of our table will appear at the bottom of the database. Clicking on the name of the table, we will see the table on the right side.

The table has been successfully created
The table has been successfully created

The table that we have now created manually can be easily created by coding this table. This requires coding the sql file with all the details of the table. Once the sql file is run, a table is created in the database.

Create table using sql coding

Friends, as I said before, Little by little if we try to petal or understand something, Then it is very convenient to understand that. If we take the whole thing at once, it is more likely to be forgotten and difficult to understand. So we are discussing the subject matter in short in each article to understand the whole subject better by taking short lessons.

I sincerely hope that you have no problem understanding this article today. Please try again and again to understand better. Friends, trying again and again will not cause any problem on your live web hosting server. You can create new tables and databases by deleting tables and databases.

The last few words

Friends, I hope you enjoyed today’s article. Share this article with your family and friends. If you have any problems with today’s air ticket, please let us know in the comment box. We will try to resolve your comment as soon as possible.

If you have trouble creating your database and table, you must let us know and we will try to resolve your issue.

Spread the love

Leave a Comment