This topic describes how to query and change a schema by using an SQL statement or the graphical user interface (GUI) on the SQL Console page.

Prerequisites

You have the permissions to query, modify, and export data in a database. For more information, see Manage permissions.

Usage notes

Schema changes may affect relevant databases and business. Proceed with caution when you change a schema.

Query a schema

  1. Go to the SQL Console page.
  2. In the navigation tree on the left of the SQL editor, right-click the target table and select Object Information.
    Object Information
  3. In the Basic information dialog box, click the Create statement tab. The SQL statement that was used to create the table appears.
    Basic information dialog box
Note You can also enter a desc clause in the SQL editor to query the schema of the table.使用desc查询table

Change a schema by using the GUI

This section uses an example of adding a column to describe how to change a schema by using the GUI. You can also perform other changes on a schema, such as adding an index to a foreign key or modifying the storage engine.

  1. Go to the SQL Console page.
  2. In the navigation tree on the left of the SQL editor, right-click the target table and select Edit Table Structure.
    Edit Table Structure
  3. On the Change Table tab, click Column Info on the left.
    Column Info
  4. Click New.
  5. A new row appears. Enter relevant information in the new row and click Modify in the lower part of the tab.
    Change Table tab
  6. In the Modify dialog box, click Execute.
    Modify dialog box

Change a schema by using an SQL statement

  1. Go to the SQL Console page.
  2. On the SQLConsole tab, enter an SQL statement for changing the schema of the target table in the SQL editor and click Execute.
    SQL editor

References

For information about how to make multiple changes to a schema at a time in a quicker manner, see Data import and Common data change.