## モジュール 1: データ準備

+ この演習では、次の実験のために実験データをTiDBデータベースにインポートします。universeというデータベースを作成します。

### 手順 1. リモート Linux にログインします

+ ここをクリック - [ターミナル 1](ssh://monitor1-ssh#1) で、ハンズオン演習用に割り当てられた仮想マシンに接続された新しいターミナルを開きます。

### 手順 2. TiDBに接続し、`test`データベースを使用

  ```bash
  cd universe/
  ```

  ```bash
  mysql -h ${HOST_DB1_PRIVATE_IP} --port 4000 -u root
  ```

  ```sql
  use test;
  ```

  ```output
  Database changed
  ```

### 手順 3. データのインポート

  ```sql
  source universeV2.sql
  ```

  ```output
  Query OK, 0 rows affected, 1 warning (2.03 sec)
  ```

### 手順 4. `universe`を現在のデータベースに設定

  ```sql
  use universe;
  ```

  ```output
  Database changed
  ```

### 手順 5. インポートされたデータをチェック

  ```sql
  SHOW TABLES;
  SELECT COUNT(*) FROM stars;
  SELECT COUNT(*) FROM planets;
  SELECT COUNT(*) FROM moons;
  SELECT COUNT(*) FROM planet_categories;
  SELECT COUNT(*) FROM discoveryFacility;
  SELECT COUNT(*) FROM parameterReference;
  SELECT COUNT(*) FROM planetarySystem;
  ```

  ```output
  tidb>show tables;
  +--------------------+
  | Tables_in_universe |
  +--------------------+
  | discoveryFacility  |
  | moons              |
  | parameterReference |
  | planet_categories  |
  | planetarySystem    |
  | planets            |
  | stars              |
  +--------------------+
  7 rows in set (0.00 sec)

  tidb>select count(*) from stars;
  +----------+
  | count(*) |
  +----------+
  |        2 |
  +----------+
  1 row in set (0.00 sec)

  tidb>select count(*) from planets;
  +----------+
  | count(*) |
  +----------+
  |       10 |
  +----------+
  1 row in set (0.00 sec)

  tidb>select count(*) from moons;
  +----------+
  | count(*) |
  +----------+
  |       28 |
  +----------+
  1 row in set (0.00 sec)

  tidb>select count(*) from planet_categories;
  +----------+
  | count(*) |
  +----------+
  |        3 |
  +----------+
  1 row in set (0.00 sec)

  tidb>select count(*) from discoveryFacility;
  +----------+
  | count(*) |
  +----------+
  |       70 |
  +----------+
  1 row in set (0.00 sec)

  tidb>select count(*) from parameterReference;
  +----------+
  | count(*) |
  +----------+
  |     2055 |
  +----------+
  1 row in set (0.00 sec)

  tidb>select count(*) from planetarySystem;
  +----------+
  | count(*) |
  +----------+
  |    34713 |
  +----------+
  1 row in set (0.02 sec)
  ```
