Updated on 2023-12-13 GMT+08:00

Executing SQL Statements

This section describes how to execute SQL statements.

Procedure

  1. Log in to the management console.
  2. Click in the upper left corner and select a region and project.
  3. Click in the upper left corner, and under Databases, click Data Admin Service.
  4. In the navigation pane on the left, choose Development Tool.

    You can also click Go to Development Tool on the overview page.

  5. Locate the DB instance that you want to log in to and click Log In in the Operation column.
  6. On the top menu bar, choose SQL Operations > SQL Query.
  7. Select a database and schema.

    Figure 1 Selecting a database and schema

  8. Enter a SQL statement in the SQL window and click Execute SQL.

    • Enabling SQL Input Prompt is recommended. It helps you select the required database, table, or field name when you enter a SQL statement in the SQL window.
    • You can execute multiple SQL statements at a time. Separate them using semicolons (;). You can click Full Screen to view logics in SQL statements clearly.
      • To execute some of the SQL statements, select the statements before executing them.
      • To execute all SQL statements, do not select any SQL statements or select all SQL statements.

  9. View execution details of the current SQL statement and previously executed SQL statements in the lower part of the page.
  10. Click the Messages tab, view SQL execution details, including affected rows, progress, and time required.
  11. On the Result Set tab, view SQL execution results. You can perform the following operations on the result sets:

    • Copy Row/Copy Column: copies a row or column for reuse.
    • Column Settings: customizes the columns to display when there are a large number of columns in the query result.
    • Refresh: refreshes changed data.
    • Row Details: displays the column field name, value, and type of the selected row.