導入數據到ClickHouse數據庫可以通過使用ClickHouse客戶端工具或PHP代碼來實現。以下是使用PHP代碼導入數據到ClickHouse的示例:
<?php
$host = 'localhost';
$port = '8123';
$username = 'username';
$password = 'password';
$database = 'database';
$connection = new ClickHouseDB\Client(['host' => $host, 'port' => $port, 'username' => $username, 'password' => $password, 'database' => $database]);
$data = [
['column1_value1', 'column2_value1'],
['column1_value2', 'column2_value2'],
['column1_value3', 'column2_value3'],
];
$connection->insertBatch('table_name', $data);
$query = "SELECT * FROM table_name";
$result = $connection->select($query)->rows();
print_r($result);
通過以上步驟,您可以使用PHP代碼將數據導入到ClickHouse數據庫中,并從數據庫中導出數據。希望這可以幫助到您。