How can you fetch a system configuration value programmatically in Magento?

We always have a requirement to get value from core_config_data table in Magento 2. Magento uses ScopeConfigInterface to read config values from database located at /vendor/magento/framework/App/Config/ScopeConfigInterface.php. Do navigate this file to understand it better.

Method defined in the ScopeConfigInterface uses the Scope type as a parameter where ‘default’ is the default scope type. ScopeInterface located at /vendor/magento/module-store/Model/ScopeInterface.php have Scope Types available in the Magento as follows :

Best example to check is the Magento own Model class.