How to create database table in magento 2?

In Magento 2, You need to create InstallSchema.php file in Setup folder under your module. In my case, Module name is Rbj_Training,

Below code snippets is create database table name of create_form.

Above script create create_form table with 4 fields, entity_id,name,phone_no,image

entity_id is an auto-increment field, a name is for name display, phone_no used for phone and image is for image name store.

Leave a Reply

Your email address will not be published. Required fields are marked *