Skip to main content

SQL Console for Relational Databases

Use the NineData SQL Console to query, edit, and manage relational databases from a browser-based workspace. The console supports SQL execution, object browsing, saved SQL, execution history, SQL development policy checks, and AI-assisted SQL workflows when AI features are enabled.

Before you begin

  • The database to be managed has been added to NineData. For instructions, see Managing Data Sources.

  • The data source type must be one of the following: MySQL (including MySQL series instances), SQL Server, PostgreSQL, PolarDB PostgreSQL, PolarDB Oracle, PolarDB-X, Oracle, OceanBase Oracle, OceanBase MySQL, Db2, ClickHouse, Doris, SelectDB, DM (Da Meng), Kingbase for Oracle, Kingbase for PostgreSQL, Klustron, StarRocks, SingleStore, DWS, MaxCompute, openGauss, GaussDB, TiDB, GaiaDB, GaiaDB-X, Greenplum, Lindorm, Vastbase, VectorDB, GoldenDB, MariaDB, HANA, or YashanDB.

  • You must have read-only or read-write permissions on the target data source.

    tip

    Read-only permissions only support viewing the database and SELECT operations.

  • In the commercial versions (DevOps Pro, DevOps Enterprise), make sure your monthly or yearly subscription has not expired. An expired subscription may prevent you from using the Database DevOps service. Check the remaining quota and expiration date in the NineData Console header.

    check_quota

Features

NineData SQL Console provides several functions for managing relational data sources efficiently.

Function
Description
Chat2SQLUse NineData AI services to generate SQL statements or optimize existing SQL. Enter concise natural language to generate a query, or provide SQL and optimization goals for AI suggestions.
AI features
  • SQL Optimize: Analyze the SQL statement on the current cursor line and provide optimization suggestions.
  • AI Format: Analyze the selected SQL statement and format it for readability.
  • Convert Schema: Convert the current table's CREATE TABLE statement into CREATE TABLE statements for other database types.
  • Generate Code: Convert the current table structure into code in supported programming languages.
  • Convert To (AI): Convert the current function into code in supported programming languages.
  • AI Diagnosis: Analyze SQL execution errors and provide likely causes and recommended actions.
Execute SQL Statements
  • Access data in the data source.
  • Add, delete, and modify databases, tables, and rows.
  • Create views, stored procedures, functions, triggers, and events.
  • Grant or revoke user permissions.
Visual Table Structure DesignCreate or edit tables visually. For more information, see Design MySQL Table Structure, Design ClickHouse Table Structure, and Design PostgreSQL Table Structure.
SQL IntelliSenseWhen you type SQL statements in the SQL Console, SQL Console suggests keywords, functions, databases, tables, columns, SQL templates, grammar help, and grammar checks based on the current context.
Save SQL | View SQLSave frequently used SQL statements to NineData and reuse them later from different browsers or hosts.
Workspace recoveryIf the browser exits unexpectedly or the host becomes unavailable, sign in to the NineData console again and open SQL Console. NineData reloads previously opened data sources and executed SQL statements from the saved workspace state.
SQL Execution HistoryHistory records SQL statements executed by the current account in the NineData console and supports retrieval by data source, execution time, and SQL keywords. Copy SQL statements from execution history and run them again in the SQL Console.
SQL Development Policy CheckIn organization modelThe organization model supports assigning different roles and resource management permissions to each user under the organization, suitable for multi-user collaborative development within the same organization, while ensuring data security and improving overall productivity., NineData checks every SQL statement executed in SQL Console against the SQL Development Policy configured by the Administrator. If a statement violates the policy, NineData blocks it. Users can modify and resubmit the SQL, or submit a SQL task, depending on the approval process configured by the Administrator.

Procedure

  1. Sign in to the NineData Console.

  2. Go to DevOps > SQL Console.

    tip

    If a data source session is still open, NineData redirects you to that data source page.

  3. Click the text box below SQL Console. The data source selector displays the data sources that have been added to NineData. Select the target data source, and then click Query to open the SQL Console.

    tip
    • If no data source exists yet, the page is empty. Click Create Datasource on the page.
    • If multiple data sources are available, enter complete or partial keywords for exact or fuzzy search. The searchable fields are:

      • Data source name

      • IP address

        search

  4. After the SQL Console opens, run SQL development operations on the selected data source.

    Execute SQL in the SQL Console

    For interface details, see SQL Console interface.

    tip

    If a sensitive data column is added to the target data source, the full content of the sensitive column remains hidden until you apply for sensitive column permission.

    Sensitive data masking in the SQL Console

Result

The SQL Console opens the selected data source. Browse database objects, run SQL statements, inspect execution results, edit supported result sets, view SQL history, and use AI-assisted SQL features if they are enabled for the current edition.

SQL Console interface

SQL Console interface

Serial number
Function
Description
1SQL console tabDisplays the SQL Console tab currently open for the data source. Click a tab to switch between multiple SQL Consoles. Click the X on the tab to close the corresponding SQL Console. Double-click a tab to rename it, and drag a tab to adjust its position. The context menu supports these actions:
  • Instance Details: Open the current data source details window.
  • Rename Tab: Rename the current tab.
  • Duplicate Query: Open a SQL Console for the current data source.
  • New Query: Open a new data source SQL Console.
  • Close Tab: Close the current tab.
  • Close Others: Close all other SQL Consoles except the current one.
  • Close Tabs to the Left: Close all SQL Consoles to the left of the current SQL Console.
  • Close Tabs to the Right: Close all SQL Consoles to the right of the current SQL Console.
  • Close All: Close all SQL Consoles.
2Open data sourceSelect and open another data source in SQL Console.
3Data source informationDisplays information about the current SQL Console data source, including the environment, IP address, and port number.
4Favorite|Refresh
  • Favorite: Click the favorite icon to add the current data source to My Favorites for quick access when opening a new SQL Console.
  • Refresh: Refresh the data in the current data source.
5Database nameSelect the target database for SQL operations. This is equivalent to the USE statement.
6Function
  • execute: Execute Execute the selected SQL statement.
  • optimizedSQL: SQL Optimize Analyze the SQL statement on the cursor line and provide optimization suggestions.
  • format: Format: Format the selected SQL statement for readability.
  • plan: Execution Plan: View the execution plan of the selected SQL statement.
  • collect: Favorite this SQL: Save all SQL statements in the current SQL Console to the SQL list for later use.
  • sqlfile: Favorites: View saved SQL statements. Insert the target SQL with Insert, or use Edit and Delete.
  • sqlhistory: History: View the execution history of SQL on the target data source. Filter execution history by time period or search by keyword, such as SQL statement, database name, or error message.
  • setting02: Settings
    • Keep Threads (MySQL only): Keep the current SQL Console connected to the data source. Use this for sessions that must persist state, such as session parameters or intermediate query results.
    • Results: Choose Overwrite or Append.
      • Overwrite (default): The new result set overwrites the previous execution result.
      • Append: Open the new result set in a new tab.
    • Theme: Change the SQL Console theme. Choose Light or Dark.
    • Font Size: Drag the slider to adjust the font size of SQL statements in the SQL Console. Default values:
      • Windows: 16
      • MacOS: 13
  • thread: View Threads (MySQL, ClickHouse, SQL Server, PostgreSQL, Oracle, OceanBase Oracle): Displays active connections on the current database server and the queries running in those connections. View Threads refresh intervals are 5, 10, 20, or 30 seconds.
  • admin: Enable Admin Mode|Disable Admin Mode Only Administrator can use this mode. When enabled, SQL executed in SQL Console bypasses standardization and approval flows.
  • download: Import Demo Dataset Generate a test dataset in the current data source (only supported in test data sources).
  • er: Logical E-R diagram (MySQL and OceanBase MySQL only) View the logical E-R diagram of the current database.
  • expend: Full Screen Open SQL Console in full-screen browser mode. In full-screen mode, click compress Exit to restore the original SQL Console size.
  • ai_diagnosis: AI Diagnosis opens the ChatDBA window in the SQL Console side panel. Use it to retrieve knowledge base content while writing SQL or to view AI diagnosis history.
7SearchSearch object names. Select an object type on the left, then search for the corresponding object name on the right. This supports databases, tables, columns, views, functions, stored procedures, triggers, and events. Object search currently supports MySQL, PostgreSQL, Oracle, and DAMENG. For other data sources, enter the table name to quickly locate the target data table.
8Database listLists all databases and tables in the current data source. Supported functions vary by data source type:
MySQL|OceanBase|PolarDB-X|PolarDB MySQL|AnalyticDB MySQL|TDSQL-C MySQL|GaussDB for MySQL|Aurora MySQL|GaiaDB|GaiaDB-X|GreatSQL | MariaDB
  • Create Database: Right-click any database, click Create Database, enter the Name, Character, and Collation in the dialog, click OK to create a database.
  • Convert Schema: Right-click the target table, click Convert Schema to convert the current table's DDL statement into DDL statements for various database types using AI.
  • Generate Code: Right-click the target table, click Generate Code to convert the current table structure into code for various programming languages using AI.
  • Convert To (AI): Right-click the target stored procedure or function, click Convert To (AI) > Programming Language to convert the current stored procedure or function into code for the target programming language using AI. Supported languages: Java, Python, C#, C++, Golang, Rust, NodeJS.
  • Add Table Notes For AI (MySQL only): Right-click the target database, table, or column, and click Add Table Notes For AI to add comments to the target table and fields. For more information, see Chat2SQL.
  • Create Table: Right-click the target database or any table in the database, click Create Table to create a data table. For more information, see Designing MySQL Table Structures.
  • Alter Table: Right-click the target table, click Alter Table to edit the structure of the target table. For more information, see Designing MySQL Table Structures.
  • Create Non-Table Objects: Right-click the target database, select Create Object > Non-Table Object Name to create non-table objects. Supported non-table objects include views, stored procedures, triggers, events, and functions. For more information, see Creating Non-Table Objects in MySQL Visually.
  • Manage Non-Table Objects: Right-click the name of the non-table object under the target database to execute operations such as create, edit, rename, copy, and delete for non-table objects. Supported non-table objects include views, stored procedures, triggers, events, and functions.
  • Export: Right-click the target database or table, click Export to export the data table in various formats.
  • Import: Right-click the target database or table, click Import to import data into the target database table using various methods.
  • View Users: Right-click the User at the bottom of the database list, click View Users to view all user information in the current data source.
Oracle|OceanBase Oracle |DaMeng
  • Convert Schema: Right-click the target table, click Convert Schema to convert the current table's DDL statement into DDL statements for various database types using AI.
  • Generate Code: Right-click the target table, click Generate Code to convert the current table structure into code for various programming languages using AI.
  • Convert To (AI): Right-click the target function, click Convert To (AI) > Programming Language to convert the current stored procedure or function into code for the target programming language using AI. Supported languages: Java, Python, C#, C++, Golang, Rust, NodeJS.
SQL Server
  • Convert Schema: Right-click the target table, click Convert Schema to convert the current table's DDL statement into DDL statements for various database types using AI.
  • Generate Code: Right-click the target table, click Generate Code to convert the current table structure into code for various programming languages using AI.
  • Convert To (AI): Right-click the target stored procedure or function, click Convert To (AI) > Programming Language to convert the current stored procedure or function into code for the target programming language using AI. Supported languages: Java, Python, C#, C++, Golang, Rust, NodeJS.
ClickHouse
PostgreSQL|Greenplum|Klustron|DWS|openGauss|GaussDB| Vastbase
  • Create Database: Right-click any database, click Create Database, and enter the required parameters in the dialog, then click OK to create a database.
  • Create Schema: Right-click the target database or any schema, click Create Schema to create a schema.
  • Edit Schema: Right-click any schema, click Edit Schema to edit a schema.
  • Add Table Notes For AI (PostgreSQL, Vastbase): Right-click the target database, table, or column, and click Add Table Notes For AI to add comments to the target table and fields. For more information, see Chat2SQL.
  • Create Table (PostgreSQL, Greenplum, Vastbase): Right-click the target database, schema, or any table in the database, then click Create Table to create a data table. For more information, see Designing PostgreSQL Table Structure.
  • Alter Table (PostgreSQL, Vastbase): Right-click the target table, then click Alter Table to edit the table structure. For more information, see Designing PostgreSQL Table Structure.
  • Create Role: Right-click Login/Group Roles or the target role, click Create Role, enter the required parameters in the dialog, then click OK to create a role.
  • Edit Role: Right-click the target role, click Edit Role to edit the role.
TiDB
  • Create Database: Right-click any database, click Create Database, in the dialog, enter Name, Character, and the corresponding Collation, click OK to create the database.
  • Create Table: Right-click the target database or any table in the database, click Create Table to create the table.
  • Alter Table: Right-click the target table, click Alter Table to edit the target table structure.
Lindorm
  • Export: Right-click the target database or table, click Export to export the data table in various formats.
  • Import: Right-click the target database or table, click Import to import data into the target database table using various methods.
Common Functions
  • Database Details or Schema Details: Right-click the target database or Schema, click Database Details or Schema Details to open the Database Details or Schema Details page. View details of the target database (PostgreSQL, KingBase, Klustron, GBase is currently not supported).
  • Select Rows: Right-click the target table, click Select Rows to query the data in the table. By default, it returns 100 rows.
  • Table Details: Right-click the target table, click Table Details to open the Table Details page. View the Column, Indexes, and Triggers of the target table (GBase is currently not supported).
  • Select Rows: Right-click the target view, click Select Rows to query the data in the view. By default, it returns 100 rows.
  • Generate DDL: Right-click the target object, click Generate DDL to generate the SQL statement for creating the object (not supported for some object types depending on the data source).
  • Duplicate Query: Open a SQL Console for the current data source.
  • Refresh: Right-click any object, click Refresh to refresh the database list.
  • View Object Details: Hover over the target table name, column name, or index name to display the corresponding detailed information.
9SQL editorThe SQL editor supports these features:
  • SQL Execution: Supports single statement or batch execution.
  • Chat2SQL (MySQL, PostgreSQL, Vastbase): Type / in the editor to enable Chat2SQL mode. Use concise natural language to generate SQL statements. For more information, see Chat2SQL.
  • Interrupt execution: Click Stop to stop a running SQL statement.
  • Syntax highlighting: Highlights SQL syntax elements in different colors for readability.
  • SQL IntelliSense: Displays suggestions based on SQL context as you type.
  • View SQL syntax help: Select an SQL keyword, right-click it, and select Help to view help information.
  • SQL templates: Use templates for common CREATE, SELECT, INSERT, UPDATE, and DELETE statements. Enter the leading keyword to select the corresponding template. For example, enter CREATE to choose templates such as CREATE TABLE or CREATE VIEW.
  • Right-click Menu:
    • Execute: Execute the SQL statement at the cursor position.
    • Format: Format the selected SQL statement for readability.
    • SQL Optimize: Analyze the SQL statement on the cursor line and provide optimization suggestions.
    • Execution Plan: View the execution plan of the selected SQL statement.
    • Favorite this SQL: Save all SQL statements in the current SQL Console to the SQL list for later use.
    • Favorites: View saved SQL statements. Insert the target SQL with Insert, or use Edit and Delete.
    • History: View the execution history of SQL on the target data source. Filter execution history by time period or search by keyword, such as SQL statement, database name, or error message.
    • View Threads: Displays active connections on the current database server and the queries running in those connections. View Threads refresh intervals are 5, 10, 20, or 30 seconds.
    • General operations: Use Cut, Copy, Paste, and Select All.
    • Select Current SQL: Select the SQL statement at the cursor position.
    • Help: AI analyzes the selected content and explains SQL syntax, target table structure, and overall SQL logic.
10Execution information and result setDisplays execution information and result sets for SQL queries.
  • Execution information: Displays execution time, executed SQL statement, status, duration, and other details. When an execution error occurs, a AI Diagnosis button appears. Click AI Diagnosis to open the ChatDBA window in the side panel. ChatDBA analyzes the error cause and provides actionable recommendations.
  • Result set: Displays the returned SQL query results. Available actions:
    Edit Result Set (Conditions: Single table query, includes primary key column or unique key column)
    • Click Add, Delete, or edit data directly to insert, delete, or update database rows.
    • Edit Row: Right-click the target cell, select Edit Row, and edit all fields in the row of the cell.
    • Upload File: Right-click the target cell, select Upload File, and upload a file to set the current cell value.
    • Paste Row: Right-click the target cell, select Paste Row, and paste copied row information over the current row.
    • Paste Field: Right-click the target cell, select Paste Field, and overwrite the current cell with the information from the clipboard.
    • Set to Null: Right-click the target cell, select Set to Null, and set the current cell to NULL (only available if the field is not set as NOT NULL).
    • Set to Empty String: Right-click the target cell, select Set to Empty String, and set the cell to an empty value.
    • Delete Row: Right-click the target cell, select Delete Row, and delete the row containing the current cell.
    Common Actions
    • Click result_column: Display the result set in column mode.
    • Click result_row: Display the result set in row mode.
    • Click upload > Export Result: Export data in various formats. Choose the current page or all data, up to 10,000 rows.
    • Click upload > Create export task: Create a data export task in the current window. The default export scope is the current result set, without switching to the Data Export module.
    • Click togglebottom2: Scrolls the result set to the bottom of the page. Clicking togglebottom1 restores the view.
    • Click setting02: Lock, hide, or show columns in the result set.
    • Result set search: Supports Fuzzy and Exact.
    • Click the small arrow next to column names to sort the result set.
    • Copy Row: Right-click the target cell, select Copy Row, and copy the entire row of the cell.
    • Copy Column: Right-click the target cell, select Copy Column, and copy the entire column of the cell.
    • Copy Field: Right-click the target cell, select Copy Field, and copy the current cell.
    • Copy as: Right-click the target cell, select Copy as, and choose to copy the row data in multiple formats.
    • Export: Right-click any cell, select Export, and export the current result set in various formats, exporting the current page or all data (up to 10,000 rows).
    • View SQL for Result Set: Hover over the tab of the target result set to display the SQL statement for that result set.
    • View Field Details: Hover over the target field to display its name, data type, length, and comments.
    • Single-Column Search: Click the filter icon to the right of the target column name, then enter a keyword in the text box to filter and search within that column.

FAQ

  • Question: What should I do if an error is reported when opening the MySQL data source through the SQL console The user specified as a definer ('mysql.infoschema'@'localhost') does not exist?

    Answer: Create a user through an account in the local MySQL client mysql.infoschema and grant privileges. Then run these commands:

    1. Create the user: mysql> CREATE USER 'mysql.infoschema'@'localhost' IDENTIFIED BY '<Password>';

      tip

      Example: mysql> CREATE USER 'mysql.infoschema'@'localhost' IDENTIFIED BY '12345';

    2. Grant privileges: mysql> GRANT ALL PRIVILEGES ON *.* TO 'mysql.infoschema'@'localhost';