How to allow code like PHP, SQL, HTML to WPBakery Visual Composer?

You can’t write directly PHP or MySQL in a Visual Composer element. You can only write HTML and VC has a default element for that – “Raw HTML”. If you would like to use PHP functionality, you can map it to a shortcode and then put the shortcode in a simple Text Block, or using ‘vc_map’, which you linked, you can create a new custom element and then in the ‘base’ parameter you can map it to a shortcode, you created.

vc_map( array(
'base' => 'svg_icon',
'name' => __( 'Svg Icon', 'ss' ),
'class' => '',
'icon' => 'icon-heart',
'params' => array(
    array(
        'type' => 'textfield',
        'class' => '',
        'heading' => __( 'Id', 'ss' ),
        'param_name' => 'id',
        'value' => 'fb',
    ),
),
) );

function sc_svg_icon($attr) {
$attr = shortcode_atts(array(
  'id' => '',
),$attr);


ob_start(); ?>
  <svg class="icon"><use xlink:href="#<?php echo $attr['id']; ?>" /></svg>
  <?php return ob_get_clean();
}
add_shortcode('svg_icon','sc_svg_icon');