Multiple rows insert in WordPress

----------------------------------------------------
$items         = [];
$values        = [];
$place_holders = [];
$query         = "INSERT INTO {$wpdb->prefix}table_name (col1, col2) VALUES ";
foreach ( $your_data_array_here as $key => $val ) {
    array_push( $values, $col1_value );
    array_push( $values, $col2_value );
    $place_holders[] = "('%d', '%d')";
}

$query .= implode( ', ', $place_holders );
$wpdb->query( $wpdb->prepare( "$query ", $values ) );

------------------------------------------------------
//set your key and data as per your needs.

Php mysql recursive function to delete all child nodes in one table

// first action:

// find the deepest nodes if have any

   $child_kit = [ ];
   get_child_dir_ids( $fd_id, $child_kit );

   $wpdb->delete(
       $wpdb->prefix . 'table_A',
           array( 'dir_id' => $fd_id, 'eid' => $eid ),
           array( '%d', '%d' )
   );
   $wpdb->delete(
       $wpdb->prefix . 'table_A',
           array( 'parent_id' => $fd_id, 'eid' => $eid ),
           array( '%d', '%d' )
   );

   //delete all child nodes now

   if ( count($child_kit) > 0 ) {
       $dir_id_to_be_deleted = implode( ",", $child_kit );
       $query = "DELETE FROM {$wpdb->prefix}table_A WHERE eid={$eid} AND parent_id IN($dir_id_to_be_deleted)";
       $wpdb->query($query);
   }

// second action:

function get_child_dir_ids( $parent_id, &$child_kit ) {
    global $wpdb;

    $query  = "SELECT dir_id FROM {$wpdb->prefix}table_A WHERE parent_id=" . $parent_id;
    $dir_id = $wpdb->get_var( $query );
    if ( is_null( $dir_id ) ) {
        return $child_kit;
    } else {
        $child_kit[] = $dir_id;
        get_child_dir_ids( $dir_id, $child_kit );
    }

}

*** i have shown it in wordpress way but you can manage it in any programming language or platform you like********************************************************