Managing Tables

Use the Console’s Table Editor and SQL Editor to create, inspect, modify, and remove tables for your relational project.

Prerequisites for Table Management

Sign in to the Console and open your relational project. Use an account permitted to create, change, and delete its database tables.

For access instructions, see Open the Console.

The examples create ARTICLES, add a SUMMARY column, and delete the table. Use an unused table name, or adapt the examples to a demonstration table.

Console table management and application access use separate authorization paths. Configure DDS Data Grants before querying the table through an application. See Database Access Control.

Tables and Rows

In Database > Table Editor > Tables, select a table to view its rows. Select Show column details to inspect its columns.

The JavaScript Relational SDK uses from(relation) to start a row operation and select(columns) to retrieve columns. After creating ARTICLES, configure a SELECT Data Grant for the application’s Data Role.

With client initialized as described in Import and Initialize the SDK, query the table:

const { data, error } = await client
  .from("articles")
  .select("id,content,excerpt");

if (error) {
  throw error;
}

console.log(data);

Unaliased returned properties use the database column names, such as ID and CONTENT. Seeing rows in the Console does not by itself verify application access.

For filters and write operations, see Row Operations.

Creating a Table

Create the table in the Console’s SQL Editor:

  1. In your project, select Database > SQL Editor.

  2. Paste the table definition into the worksheet:

    CREATE TABLE ARTICLES (
        ID             NUMBER PRIMARY KEY,
        CONTENT        VARCHAR2(2000),
        EXCERPT        VARCHAR2(1000),
        PUBLISHED_BY   VARCHAR2(256),
        PUBLISHED_DATE TIMESTAMP WITH TIME ZONE
    );

    Description of the illustration table-management-create-articles.png

  3. Select Run Script. In Script Output, confirm that Table ARTICLES created. appears.

  4. Select Table Editor > Tables, then select ARTICLES to inspect the table.

The SQL uses unquoted identifiers, which Oracle stores in uppercase. The ARTICLES table is also used by the Data Grant Examples.

Modifying a Table

Add a column using the same SQL Editor:

  1. Select Database > SQL Editor.

  2. Replace the worksheet contents with the following statement:

    ALTER TABLE ARTICLES ADD (SUMMARY VARCHAR2(500));
  3. Select Run Script. In Script Output, confirm that Table ARTICLES altered. appears.

  4. Select Table Editor > Tables, select ARTICLES, and select Show column details. Confirm that SUMMARY appears in the column list.

    Description of the illustration table-management-articles-summary.png

    The screenshot includes a sample row.

Review application projections, writes, and grants when changing columns. For SQL syntax details, see ALTER TABLE.

Dropping a Table

Delete the demonstration table when you have finished using it.

Caution: Deleting the table removes its data and associated Data Grants. Check that you selected the intended demonstration table before confirming deletion.

  1. Select Database > Table Editor > Tables, then select ARTICLES.

  2. Open the menu beside the table name and select Delete table.

  3. Check that the Delete table dialog names ARTICLES.

    Description of the illustration table-management-delete-articles.png

  4. Select Delete. Confirm that ARTICLES no longer appears in the table list.

Getting a Table List

Find tables through the Table Editor:

  1. Open your project and select Database > Table Editor > Tables.

  2. Use Search tables to filter the table list by name.

  3. Select a table to view its rows. Select Show column details to inspect its columns.

    Description of the illustration table-management-table-list.png

Pass the relation name to client.from() for application queries. The quick start creates the unquoted TODOS table and uses lowercase request identifiers in its SDK examples.