Get Started with OceanBase Cloud

2024-06-21 03:03:07  Updated

In this tutorial, you will learn how to use the OceanBase Cloud Console to create a database and an account, and then interact with your database, including inserting and querying sample data, using the SQL Console.

Prerequisites

  • You have created a cluster instance and a tenant in the MySQL mode under the instance.
  • You have the role of an organization admin or project admin.

Step 1: Select an Instance and a Tenant

To start off, choose an instance and a tenant in the MySQL mode to proceed with this tutorial.

Note

Selecting an instance and a tenant is required in this tutorial, as all subsequent actions will be performed within the selected instance and tenant. This tutorial requires importing a sample data file of about 128 MB.

Step 2: Create a Database

  1. Click to navigate to the Databases page.

  2. Click Create Database.

  3. In the Create Database dialog, enter test_db as the database name, choose the character set, and then click Create.

Step 3: Create an Account

  1. Click to navigate to the Accounts page.

  2. Click Create Account.

  3. In the Create Account dialog, fill in the following details.

    Parameter Description
    Account Name Enter test_account.
    Account Type Select Regular Account. For more information about different types of account, refer to Create an account.
    Database Authorization Select test_db and grant the Read/Write privilege.
    Password Enter a password for test_account. Please save your password securely.
  4. Click Create.

Step 4: Insert Sample Data into Your Database

  1. Click to navigate to the Load Data page.

  2. Click Import Sample Data.

  3. In the Import Sample Data dialog, select the TPC-DS tab.

  4. Select test_db, and then click Import.

  5. Wait for the status in the Progress column to show “Succeed”, indicating successful data import.

Step 5: Interact with Sample Data

  1. Click to navigate to the SQL Console page.

  2. Select test_account under Database Account, and enter the password.

  3. Click Connect.

  4. In the SQL Console, double click test_db on the left-side pane to open a new SQL window.

  5. In the SQL window, enter the following SQL statement to view all customers in the customer table:

    SELECT * FROM customer;
    
  6. Click the Run button to execute the SQL statement.

    The Results tab will display all customer information from the customer table.

  7. To filter customers based on specific criteria, for example, generating a list of customers whose birthday month is December, enter the following SQL statement:

    SELECT * 
    FROM customer
    WHERE c_birth_month = '12';
    
  8. Click the Run button to execute the SQL statement.

    The SQL Console will return the corresponding results in the Results tab. Feel free to enter different SQL statements to explore and interact with the database using the SQL Console.

Contact Us