How to fetch data from a database and display it in Magento 2
Magento 2 Model
To get information from our table, we need to create a model which extends from AbstractModel. Models are used to connect to the database, and process data from and to it. To create that, we need to prepare a file entitled Data.php in app/code/CleverCode/HelloWorld/Model with the following contents:
These agreements may be canceled at any time. Personal data will not be shared with any other recipients. You have the right to access and amend this data at any time.