Data Management (DMS) provides the SQLConsole for you to execute SQL statements with ease. You can use this feature to add, delete, modify, or query data in a database in a visualized manner when data query or development is involved.

Prerequisites

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

Usage notes

  • If a table contains sensitive or confidential fields and you do not have permissions on the fields, the values of the fields are displayed as ****** in 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. Perform the following steps: In the top navigation bar of the DMS console, choose System > Security > Security Rules.
  • The maximum size of the table on which a full table scan can be performed is 10 GB. If you are a DMS administrator, you can change this value as needed. Perform the following steps: In the top navigation bar of the DMS console, choose System > Security > Security Rules.
  • 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 in the Advanced information section of the Edit instance dialog box.

Procedure

  1. Log on to the DMS console.
  2. In the top navigation bar, move the pointer over the All functions icon and choose SQLConsole > Single Database query.
    Note In the left-side navigation pane of the DMS console, you can also double-click the database that you want to query to go to the SQLConsole tab.
  3. Select the database that you want to query from the drop-down list or enter a keyword in the field to search for the database. After you select the database, click Confirm.
  4. Enter the SQL statement to be executed in the field of the SQLConsole tab and click Execute.
    GUI of the SQLConsole
    Table 1. GUI of the SQLConsole
    No. Section Description
    1 Visual operation section In this section, you can manage your database in a visualized manner.
    • Tables

      You can view all tables, fields, and indexes of the current database. You can also right-click a table in the database to modify table schema, import data, or export data.

    • Programmable objects
      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 (KVP) information
      Note The KVP information can be displayed only for a NoSQL database.
    2 Extended feature section In this section, quick portals to extended features are provided. You can use those features by clicking the following icons:
    • Table details: the Table List icon. You can click the Table details icon to view table details on the Table List tab. Then, 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 database.
    • DAS service icon: the Database Autonomy Service (DAS) service icon. You can click this icon to use the features of DAS, including quick diagnostics, real-time performance, instance session, and storage analysis. After you click this icon, you are navigated to the DAS console. For more information, see Real-time performance and View the session statistics of an ApsaraDB RDS for MySQL instance.
    • Sync Metadata icon: the Sync Metadata icon. After you click this icon, DMS collects the latest metadata information of the database, 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 click this icon to export the data of the database, table schemas of the database, or table creation statements. You can also click this icon to view the schema versions of this database. For more information about schema versions, see Manage schema versions.
    • Operation audit icon: the Operation audit icon. You can click this icon to view the information about all query and change records. For example, you can query the information about a specific operation, the user who performed the operation, and the time when the operation was performed. For more information, see Operation audit.

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

    • Share icon: the Share icon. You can click this icon to share the console and commands of the database with relevant staff. For more information, see Generate a share link for the SQLConsole tab of a database.
    • Super SQL mode: the Super SQL Mode icon. You can click this icon to enable the super SQL mode feature. Upon you enable this feature as a DMS administrator or a database administrator (DBA), all SQL statements that you execute in the SQLConsole will be executed directly without the limit of security rules. For more information, see Super SQL mode.
    3 Command running section In this section, you can write and execute SQL statements to manage the data of the current database. You can also use other features in this section, such as Format, Execute Plan, Saved SQL, and Settings.
    Note You can click the Add icon icon to add multiple query tabs.
    4 Execution result section In this section, you can view the execution results after SQL statements are executed. You can also view the details of a single row, and add, delete, or modify data.
    Note You can click the Execution History tab to view historical execution records. For example, you can view the start time of statement execution, database, and executed SQL statements. You can also export the execution results as needed.