You can execute various types of SQL statements on the SQL Console page of the Data Management (DMS) console. On this page, you can also add, delete, modify, and query data in the specified database instance in a visualized manner. The SQL Console page is designed for scenarios such as data query and data development.

Prerequisites

You are granted the query permissions on the database instance or table that you want to query. For more information about how to apply for the permissions, see Permission management.

GUI of the SQL Console page

SQLConsole
Table 1. GUI of the SQL Console page
No. Section Description
1 Visual operation section In this section, you can manage your database instance in a visualized manner.
  • Table

    You can view all tables, fields and their types, and indexes in the current database instance. You can also right-click a table in the database instance to modify the table schema, manage the table, import data, export data, or perform operations on multiple tables at a time.

  • Programmable Object
    You can create, view, execute, and manage programmable objects such as views, stored procedures, functions, triggers, and events.
    Note A maximum of 1,000 entries can be displayed.
  • Key-value pair information
    Note The key-value pair information can be displayed only for a NoSQL database instance.
2 Extended feature section In this section, shortcuts to extended features are provided. You can use these features by clicking the following icons:
  • Table List icon: the Table List icon. You can click the Table List icon icon to view tables in the current database instance. Then, you can click the Query icon icon to return to the SQLConsole tab.
  • Data Analysis icon: the Data Analysis icon. You can click the Data Analysis icon icon to create a data analysis ticket. For more information, see Data analysis.
    Note The Data Analysis icon is displayed only for an ApsaraDB RDS for MySQL instance.
  • DAS icon: the Database Autonomy Service (DAS) icon. You can select options from the shortcut menu of this icon to use the features of DAS, including quick diagnostics, real-time performance, instance session, and storage analysis. After you select an option, you are navigated to the DAS console. For more information, see Real-time performance and Session management.
  • Sync Metadata icon: the Sync Metadata icon. After you click this icon, DMS collects the latest metadata of the database instance, such as tables, fields, indexes, and programmable objects. This helps you manage permissions on tables, fields, and programmable objects based on different security levels. For more information, see Metadata.
  • Export icon: the Export icon. You can select an option from the shortcut menu of this icon to export the data of the database instance, table schemas of the database instance, or table creation statements. You can also select the corresponding option to view the schema versions of this database instance. For more information about schema versions, see Manage schema versions.
  • Operation Audit icon: the Operation Audit icon. You can select options from the shortcut menu of this icon to view the information about all data query and data change records. For example, you can query the information about an operation, such as the SQL type, the operator, and the time when the operation is performed. For more information, see Audit operations.

    You can also select the corresponding option to use the Risk Audit feature to collect and assess the risks that arise when the database instance is used. For more information, see Generate a risk audit report.

  • Share icon: the Share icon. You can click this icon to share the SQLConsole tab and statements of the database instance with relevant staff. For more information, see Share the SQLConsole tab.
  • Super SQL Mode icon: the Super SQL Mode icon. You can click this icon to enable the super SQL mode. After you enable this mode as a DMS administrator or a database administrator (DBA), you can execute SQL statements on the SQLConsole tab without being constrained by security rules. For more information, see Use the super SQL mode.
3 Statement execution section In this section, you can write and execute SQL statements to manage the current database instance. You can also format SQL statements, create execution plans, save commonly used SQL statements, and configure display settings.
Note You can click the Add icon icon in the upper-right corner of the section to add multiple SQLConsole tabs.
Execution result section In this section, you can view the execution results after SQL statements are executed. You can also view the details about a single row and add, remove, or modify data.
Note You can click the Execution History tab to view the historical execution records. For example, you can view the time at which the execution of an SQL statement started, the affected database instance, and the details about the SQL statement. You can also export the execution results as required.

Procedure

  1. Go to the DMS console V5.0.
  2. In the top navigation bar, choose SQL Console > SQL Console.
  3. In the Please select the database first dialog box, enter a keyword to search for a database instance, select the database instance from the search results, and then click Confirm.
  4. On the SQLConsole tab, enter the SQL statements to be executed and click Execute.

Usage notes

  • A table may contain sensitive or confidential fields and you may not have permissions to access these fields. In this case, the values of these fields are displayed as ****** in the query results. For more information, see Manage sensitive data.
  • By default, a maximum of 200 data rows can be returned for each query. If you are a DMS administrator, you can change this value as needed. To go to the page where you can change this value, perform the following steps: In the top navigation bar of the DMS console, click Security and Specifications. On the page that appears, click Security Rules in the left-side navigation pane.
  • By default, a full scan can be performed on a table that does not exceed 10 GB in size. If you are a DMS administrator, you can change this value as needed. To go to the page where you can change this value, perform the following steps: In the top navigation bar of the DMS console, click Security and Specifications. On the page that appears, click Security Rules in the left-side navigation pane.
  • By default, the timeout period for executing a single SQL statement is 60 seconds. If you are a DMS administrator, you can change this value as needed. To change this value, perform the following steps: In the top navigation bar, click Data Assets. In the left-side navigation pane, click Instances. On the Instance List tab, move the pointer over More in the Actions column of the database instance that you want to manage and select Edit. In the Edit dialog box, change the value in the Advanced Information section.