Hello guys, In this post I will guide you to create a Database and Table in MySQL. But before we get started, first we have to know what are database and table?
A Database is an organized collection of data, generally stored and accessed electronically from a computer system. And we divide our database into tables to organize our data.
A Table contains rows and columns. In each column, we define a data type and in each row, we store individual records.
Now to create a database first you need MySQL. And you can get MySQL through XAMPP software but you don’t have installed XAMPP and don’t know how to get, then watch this video. After that, start Apache and MySQL.
Then go to in a URL section of the browser, type http://localhost/phpmyadmin Then you will get a page like this.
There are two ways to create a database. Either you can create by using SQL coding Or you can create without coding just manually. Here we learn to create a database manually.
Creating a Database
On the top left portion of phpMyAdmin, you can see a NEW button.
Then give a name to your database and click Create.
Creating a Table
After that, give a name to your table and specify, how many columns you want to create then press Go. Now we need to specify some property for our column which includes the name of the column, data type for that column, length of string, index and many more.
In the Name section, define the name for each column. In the Type section, define a dataType for each column. If you set Type of column as string/text then set a Length. In a database table, we need to set one column as a primary key.
The primary Key is that column which contains only a unique record. So that we can easily work on each record of that table. Now to make a primary key, make a one column Name as id, Type as INT and Index as PRIMARY.
After you define the column name and its property then just save it.
And that’s it, you have just created a database and table. Now you can use it on your application.
Now, if you want to learn How to connect this database to your HTML form then read this.
Or you can also watch this video.