The table tab opens a single table as a work document tab. On a wide screen you edit its columns, foreign keys, indexes and constraints, and view its data and DDL. What you edit here is the same design as the same table in the ERD, and saving does not change the database. ERDs and the real database explains how saving differs from applying to the database.
What's on the screen
| No. | Name | Description |
|---|---|---|
| 1 | Inner tabs | The vertical tabs on the left. See 'Inner tabs' below. When there are unsaved changes, a dot appears next to the Schema Editor tab. |
| 2 | Table name | Shown as schema : table. In PostgreSQL, a shield icon marks a table with row-level security (RLS) enabled, and a broadcast icon marks a table in a publication. |
| 3 | Table buttons | The Delete Table..., Apply Changes to DB... and Refresh buttons. They change with the inner tab you open. See 'Toolbar' below. |
| 4 | Save and restore buttons | The Save button saves the design to the project, and the Restore... button discards unsaved changes. They can be clicked only when there are unsaved changes. |
| 5 | Database Table Information | Database, schema, table name, description, logical name and DBMS-specific options. |
| 6 | Table Columns | The column grid. Its fields are the same as in the ERD's Table node; the fields only this tab has are described under 'Column grid' below. |
| 7 | Foreign Keys, Indexes, Constraints | Tables of foreign keys, indexes and constraints. Add one with the button in the area header and delete one with the button at the end of its row. |
- Click an area's title to scroll to that area.
- The status bar at the bottom shows the table's connection, database and schema, and on the Data tab also the number of rows read.
Inner tabs
| Tab | When it appears | What it does |
|---|---|---|
| Schema Editor | Always | Edits the table definition. This tab is shown when the table tab first opens. |
| Code Generator | When template packs are assigned to the project | The entity settings for generating source code from this table. See Generating source code. |
| Data | Always | Queries and edits the table's data (see 'Viewing and editing data' below). |
| Properties | A table in the database on Databricks | Shows the properties of a Delta table and edits the supported ones. |
| DDL | Always | Shows the table's CREATE statement (see 'Viewing the DDL' below). |
| Version History | A Delta table on Databricks | Shows the table's version history, previews the data of a past version or restores the table to it. |
| Metadata | DBMSs whose database provides table metadata, such as Databricks, Snowflake and BigQuery | Shows metadata such as owner, creation time and storage format, read-only. |
Toolbar
| Open tab | Button | What it does |
|---|---|---|
| Schema Editor | Delete Table... | Deletes the table (see 'Deleting a table' below). On a table marked for deletion it becomes the Cancel Table Deletion button. |
| Schema Editor | Apply Changes to DB... | Builds DDL from this table's changes, shows it and runs it. It is the same window as Apply changes to the database. |
| Schema Editor | Refresh | Reads the table's current information from the database again. It cannot be clicked on a virtual table that is not in the database yet. |
| Code Generator | Generate Source Code..., Reset Entity Settings... | Generates source code, and resets the entity settings. See Generating source code. |
| Data | Refresh | Queries the data again. |
- The Apply Changes to DB... and Refresh buttons work only on a connection with database access details. The Apply Changes to DB... button can be clicked only when there are changes not yet applied to the database.
- The save and restore buttons (4) are hidden on the Data tab, the DDL tab and the three Databricks tabs.
Opening a table tab
- Double-click a table in the explorer. The table tab () for that table opens. If it is already open, you move to that tab.
- To open it from an ERD, select the table node and click the View in Detail Tab button in the node toolbar.
- When it first opens, the tab reads the table's columns, keys and indexes from the database. If that fails, an error and a Retry button appear.
- Double-clicking a view opens an object tab, not a table tab (Object tabs).
Creating a new table
- In the explorer, right-click a schema or the Tables item under it and click the menu.
- A virtual table with an unused name such as
table1is created and its table tab opens. Type a name in the table name field. - Define columns, foreign keys and indexes, and click the Save button.
- To create it in the database, click the Apply Changes to DB... button, check the
CREATE TABLEstatement and run it.
- The new table is saved to the project as soon as it is created, but it is not in the database. It stays a virtual table until you apply it.
- If the connection has a new table template, the table starts with those columns. Set the template in Create and edit a connection.
- In DBMSs that change the case of names when storing them, such as PostgreSQL and Oracle, the default name uses that case too (
TABLE1in Oracle). - In a system schema the menu is dimmed and cannot be clicked.
Editing columns and keys
- In the Table Columns area (6), click the new column button or the + button on the right of the grid header to add a column.
- Click or double-click a field to set the name, type, PK, N/N, default value and description.
- Add foreign keys, indexes and constraints with the Add Foreign Key..., Add Index... and Add Constraint... buttons of each area (7).
- Click the Save button to save.
New columns, edited fields and moved columns are shown in color. When you change the column order, an Order Changed mark appears next to the Table Columns title. What each field does, default values, generated columns and case preservation are described in Table node, and the windows for adding foreign keys, indexes and constraints in Table detail panel. They are the same windows.
Column grid
The column grid uses the same fields as the ERD node, and this tab shows the following fields as well.
| Field | When it appears |
|---|---|
| Logical Name | Always. In the ERD node it follows the display settings. |
| Domain | When a data dictionary domain set is assigned to the connection |
| Charset, Collation | MySQL and MariaDB. Sets the character set and collation per column. The ERD does not have these fields. |
Fields of the table information
| Field | Description |
|---|---|
| Database | Appears only in DBMSs that keep databases and schemas separate. It cannot be edited. |
| Schema | It cannot be edited. |
| Table Name | The table name. Renaming a table that exists in the database becomes a rename statement when you apply. For a virtual table in a DBMS that changes the case of stored names, a Preserve case item appears below it. |
| Description | The table description. It goes to the database as the table comment. |
| Logical Name | A human-readable name. On a connection with a data dictionary, the table name is built from the logical name. See Data dictionary. |
| DBMS-specific options | Fields that the DBMS provides, such as engine, character set and collation in MySQL and MariaDB, and tablespace in PostgreSQL and Oracle. |
In PostgreSQL and Supabase, the Logical Replication and RLS Policies areas appear below the Constraints area. They are the same as the areas of the Table detail panel.
When you change the primary key
When you change a primary key that other tables' foreign keys reference and save, the Primary Key Change Preview — orders window opens before saving. A foreign key must have as many columns as its parent's primary key, so you decide how to align the child tables' foreign keys.
- Check the old and new primary keys at the top of the window.
- In the Affected foreign keys (1) table, choose what to do for each child table.
- If you added a column to the primary key, type the name of the column to add to the child table in the New child column names field.
- If you removed or replaced primary key columns, choose Drop FK constraint only or Manual mapping. With Manual mapping, type the child columns that pair with the new primary key.
- Click the Apply button. The child tables changed along with this table are saved too.
- Closing the window does not save.
- When you apply to the database, the child tables changed along with it are included in the DDL preview with the Auto-included mark, and cannot be removed.
- If a foreign key of a table in the database references the primary key of a virtual table that is not in the database yet, the change cannot be applied. Apply the parent table to the database first.
- Existing data is not migrated. Check beforehand for columns that become NOT NULL and for referenced data.
Viewing and editing data
Opening the Data tab queries the table's data. The result grid is the same as in the SQL editor.
- It reads 200 rows first. Scroll to the end of the grid or click the Load More button below it to read 200 more rows.
- Filtering, sorting and editing are described in Result grid and Editing result data. When you apply edits,
UPDATE,INSERTandDELETEstatements run on the database right away and the data is queried again. If a statement fails, you choose between the Stop, Retry and Skip buttons. - Tables and views without a primary key can be edited too. The rows to change are then found by the values of all columns, so before applying you are asked once with There is no primary key, so the rows to change are found by the values of all columns (orders_log). Other rows with the same values may change too.. The connection profile's protection mode confirmation is asked in the same window.
- The Export button in the filter row exports the whole table's data to a file. See Exporting results.
- On a connection without database access details, nothing is queried.
Viewing the DDL
The DDL tab shows the table's CREATE statement, read-only.
- For a table in the database it is built from the database's current definition. Saved changes and changes in progress are not included, and a notice appears when there are such changes. Check the DDL with your edits in the preview of the Apply Changes to DB... button.
- For a virtual table it is built from the design.
- Turn on Include schema name to put the schema before the table name. In a non-default SQL Server schema it is always included.
- Rebuild it with the Refresh button and copy it with the Copy SQL button.
- Databricks shows the database's
SHOW CREATE TABLEresult as is.
Saving, restoring and applying
- After editing, click the Save button. The design is saved to the project, and the database does not change.
- To discard unsaved changes, click the Restore... button and confirm. The table returns to its last saved state.
- To create it in the database, click the Apply Changes to DB... button, check the statements in the preview and run them. See Apply changes to the database.
- If you close the tab without saving, you are asked whether to save. Closing without saving returns the table to its last saved state.
- When you click the Refresh button on a table with changes not applied to the database, you choose between the Merge and Replace buttons. It is the same as refreshing in the explorer, and is described in Table node.
- In a signed-in account project, a member whose DDL execution is restricted requests approval instead of running it. See DDL approval.
Deleting a table
When you click the Delete Table... button, you are asked how to handle it depending on the table's state.
| Table | What it does |
|---|---|
| A virtual table not in the database yet | Deletes it from the project. The tab closes. |
| A table in the database | Flag Only (Keep in the database) only marks it for deletion and drops it at the next apply. Execute DROP TABLE (Delete from the database) previews the DROP TABLE statement and runs it. |
| A table marked for deletion | Previews the DROP TABLE statement and runs it. |
A table marked for deletion cannot be edited, and the Deleted Table notice appears over the Schema Editor tab. Undo it with the Cancel Table Deletion button.
How it differs from the ERD detail panel
The Table detail panel below the ERD canvas edits the same table too. Both edit the same design, so what you change in one appears in the other right away.
| Table tab | ERD detail panel | |
|---|---|---|
| Opened from | Double-clicking a table in the explorer, or the View in Detail Tab button of an ERD node | Clicking a table node on the ERD canvas |
| Columns | The column grid in the tab, with per-column character set (MySQL and MariaDB) and logical name fields | Edited in the node on the canvas |
| Saving and applying | The tab's buttons | The node toolbar and info panel buttons |
| Code generation and Databricks tabs | Yes | No |
| Node color and notes | No | In the NeoSQL Properties area |
Things to keep in mind
- The Save button does not change the database. The table that the explorer and other people see in the database changes only when you run the Apply Changes to DB... button.
- Conversely, data edits applied on the Data tab run on the database right away, regardless of the save button.
- For a table in the database, the DDL tab does not show your edits. Check the DDL that will run in the apply preview.
- If you choose the Replace button after the Refresh button, all edits not applied to the database are lost.
- Tables in a system schema are read-only. The Tables in system schemas are read-only. DDL changes are blocked. notice appears over the tab, and you cannot save or apply.
- In a signed-in account project, when you are a member whose DDL execution is restricted, a table that another team member is editing becomes read-only with the This table is being modified by another team member and cannot be edited. notice.
Related screens
- Object explorer: pick a table, and create a new table from the right-click menu.
- Table node: the column grid fields, default values, generated columns and case preservation.
- Table detail panel: the windows for adding foreign keys, indexes and constraints, and the RLS and publication areas.
- Apply changes to the database: preview and run the DDL of your changed design.
- Editing result data: how to edit rows on the Data tab.
- Generating source code: the Code Generator tab.