An example of creating a table in Mysql database with WordPress function.

/* id and COLUMNNAME are the columns of new database table which name is new_table_name ) */
  
global $wpdb;
 
$charset_collate = $wpdb->get_charset_collate();
$table_name = $wpdb->prefix . 'new_table_name';
 
$sql = "CREATE TABLE $table_name (
    id mediumint(9) NOT NULL AUTO_INCREMENT,
    COLUMNNAME longtext NOT NULL,
    UNIQUE KEY id (id)
) $charset_collate;";
 
 
dbDelta( $sql );