Skip to main content

Table Editing

Table editing basically offers an editing experience similar to Excel.
Editing mode starts with Enter, or by double-clicking a cell.
Enter or Escape ends it. What you type is applied as you type it, so Escape keeps the text rather than reverting it.
Escape leaves the cell focused and the table selected, and a second Escape clears both.
While an input method is still composing, Escape leaves editing mode open.

Adding a table with Alt + N and filling in two columns

Adding Columns​

Created using the shortcut Alt + Enter (Windows/Linux) or ⌥ + Enter (Mac).
A column is added to every selected table.

Tab Key​

Press Tab to move straight into the next cell's editing mode.
Pressing Tab in the last cell creates a new column.
Use Shift + Tab to navigate to the previous cell's editing mode.
The alternate key marks drawn after a row's last cell are not cells, so keyboard focus passes over them and they never open for editing.

Tab moving through a row's cells, adding a column from the last cell, and Shift + Tab going back

DataType Autocomplete​

Start editing a DataType cell and type. Matching types from the selected database are suggested, and the part of a suggestion that literally contains what you typed is highlighted.
The match itself is fuzzy, so vch also finds VARCHAR.

  • Arrow Up or Arrow Down: move through the suggestions
  • Arrow Right, Tab or Enter: accept the highlighted suggestion
  • Arrow Left: go back to the text you typed

You can also click a suggestion.
The list shows up to ten suggestions at a time and scrolls for the rest.
Nothing is forced, so a type that is not in the list can be typed freely, including arguments such as VARCHAR(255). The list closes once what you type runs past a whole type name, as VARCHAR(255) or BIGINT UNSIGNED does.
The suggestions follow the selected database. Changing the database changes what is offered and leaves existing columns as they are.

Filling in DataType cells from fuzzy suggestions with the arrow keys, Tab and Enter

Not Null, Unique, Auto Increment​

These three cells are toggles rather than text.
Double-click one, or press Enter while it is focused, to flip it.

The Not Null cell reads N-N when it is set and NULL when it is not.
UQ and AI are dimmed when off and highlighted when on.

Flipping Not Null with a double-click, and Unique and Auto Increment with Enter

Cells hidden by the table view options cannot be toggled.

Selecting Multiple Columns​

Supports five methods:

  • Shift + Arrow Up/Down: extend the selection one row at a time
  • Ctrl + click (Windows/Linux) or ⌘ + click (Mac): add a single column
  • Shift + click: select the range from the last focused column
  • Ctrl + Shift + click (Windows/Linux) or ⌘ + Shift + click (Mac): add that range to the selection
  • Alt + A (Windows/Linux) or ⌥ + A (Mac): Select All

Selecting columns with Shift + Arrow Down, Ctrl/⌘ + click, Shift + click and Alt + A

A right-click on a column's row decides which columns the table context menu acts on, whatever modifier key is held.
On a row that is already selected, the selection stays and the focus moves to that row. On any other row, that row alone is selected. This holds anywhere on the row, including the key icon and an alternate key mark.
So to act on several columns from the menu, as in Column Primary Key or Column Deletion, right-click one of the selected rows.
On a Mac, Ctrl + click opens the menu too, but it counts as a plain click, so on a cell it selects that row alone before the menu opens.

Rearranging and Moving Columns​

Functions when dragging, enabling movement to other tables.
The dragged rows follow the pointer, and the rows around the drop point slide aside to make room.
Drop just below a table's last row to move the column to the end of that table. A table with no columns takes the drop anywhere on it.

Dragging a column to a new position, then into another table

Supports moving multiple columns with Ctrl + drag (Windows/Linux) or ⌘ + drag (Mac).

Selecting three columns and moving them into another table with Ctrl/⌘ + drag

Column Deletion​

Deletes the selected columns of the focused table. Clicking a cell selects its column, so clicking a cell and pressing Delete removes that one column.
Shortcuts:

  • Delete or Backspace (⌫ on a Mac). These remove the selected columns while their table is the only thing selected. With no column selected (the focus on the table name or comment), with anything else selected too, or at 70% zoom and below, where tables show only their names, they remove the whole selection instead — see Table and Memo Deletion.
  • Alt + Backspace or Alt + Delete (Windows/Linux), ⌥ + ⌫ or ⌥ + Delete (Mac). These remove the focused table's selected columns even while other tables or memos are selected too. They remove nothing while a cell is being edited or at 70% and below.

Deleting one column, then two selected columns, with Alt + Backspace

The table context menu does the same. With the table the only thing selected, right-click a column's row: the menu's last row reads Delete column, or Delete columns when that row is one of two or more selected columns.

While a cell is being edited, Delete and Backspace only erase text. Held down outside the cell editor, they remove only once.
After a removal, the focus moves to the nearest remaining column above the focused one. When none is left above it, the focus moves to the table name even if columns remain below, so the next Delete or Backspace removes the table rather than a column.
Relationships and indexes that use a removed column are removed with it. There is no confirmation, and the whole removal is one undo step.

Copying/Pasting Columns​

Operates like a table-based clipboard.
Shortcuts: Ctrl + C (Windows/Linux) or ⌘ + C (Mac), Ctrl + V (Windows/Linux) or ⌘ + V (Mac)

Copying out to a spreadsheet, pasting in from one, and pasting into the table whose column cell is focused use the cells the tables show, in the order they show them — see Table View Options and Adjusting Column Order.
Columns copied in the editor and pasted with a table header selected, or into the other selected tables, carry every cell of the copied columns, including hidden ones such as Unique and Auto Increment.
Alternate key marks such as AK1.1 are not cells, so copying and pasting leave them out even while they are shown.

You can paste from the editor into Excel and from Excel back into the editor.
Cell values go out exactly as typed, so a value such as <label> or a &amp; b reaches a spreadsheet or a document unchanged.
Spreadsheet columns are matched to the visible cells by position, not by name, so the sheet's columns must follow their order.
For the columns below, any of these values is read as true (case insensitive):

  • AutoIncrement: TRUE, 1, YES, Y
  • Unique: TRUE, 1, YES, Y
  • Not Null: TRUE, 1, YES, Y, NOT NULL

On the way out the editor writes TRUE or FALSE for AutoIncrement and Unique, and NOT NULL or NULL for Not Null.
Unique and Auto Increment are hidden by default, so TRUE and FALSE are written and read only once those cells are shown.

Pasting four columns into a spreadsheet, with flags written as TRUE/FALSE and NOT NULL/NULL

Pasting three spreadsheet rows into a table as columns, with YES, 1 and NOT NULL read as true

Where a paste lands depends on the focus:

  • With a table header selected, the pasted rows are added as new columns to every selected table.
  • With a column cell focused, that table's selected rows, and then the rows below the last of them, are overwritten in order, as many as were pasted. Rows between separate selections are skipped. An overwritten row takes the pasted values in its visible cells and keeps its hidden ones, and the rows left over are added as new columns. Every other selected table gets the pasted rows added as new columns.

Copying two columns and pasting them into two selected tables at once

Copying/Pasting Tables and Memos​

When no column is selected inside a focused table, the same shortcuts copy the selected tables and memos themselves — see Table-related Functions.

Column Primary Key​

Toggles the primary key on the focused column, which is the column the focused cell belongs to.
When the focused column is one of two or more selected columns, the toggle applies to all of the selected columns: if any of them is not a key, all of them become keys, and if all of them already are, all of them are cleared. Columns outside the selection are left alone.
Use the table context menu or the shortcut Alt + K (Windows/Linux) or ⌥ + K (Mac). When the toggle reaches two or more columns, the menu row reads Primary Key on selected columns instead of Primary Key.
The key icon in the row is display only, so clicking it does not set the key.

To make several columns one composite key, select them, then press Alt + K (Windows/Linux) or ⌥ + K (Mac), or right-click one of the selected rows and choose Primary Key on selected columns. Each toggle is one undo step.

Selecting two columns with Shift + Arrow Down, then making both the primary key with ⌥ + K and clearing both with a second press