Make, empty and drop tables
Make a table by filling in its columns, or take one away. In both cases you read the SQL before it runs.
On this page
Make a table
- Press New table…, the plus next to Find a table.
- Write its name. If the database has several schemas, choose one.
- Fill in the columns. There are two to begin with: a key called
id, which the database numbers, and an empty one for text. - Press Column for each one more. Those without a name are left out.
- Press Review, read the statement, and press Make the table. Back returns to the columns.
| Column of the form | What it means |
|---|---|
| Type | Choose one of the common types, or write any that your database has |
| Default | An expression: 0, 'new', now() |
| NULL | It may have no value |
| Key | Part of the primary key. Mark several for a key of several columns |
| Numbered | The database gives the numbers: 1, 2, 3… Only for a key |
Then add its indexes, relations and rules. In SQLite, relations and rules are set when the table is made, so write its CREATE TABLE in a query if you need them.
Rename a table
In Structure, press Rename the table… Views, functions and programs that name the table are not changed with it.
Start a query on a table
With the right button, New query on it opens a query that takes the first 100 rows of the table, in the words of your database and with the name between its quotes.
Copy the name copies the name of the table, with its schema.
Empty a table
Choose Empty… with the right button. Every row goes and the table stays. If other tables point to this one, the database may refuse.
Drop a table or a view
Choose Drop… with the right button. A table goes with every row that it has.
Emptying and dropping cannot be undone. Export the table first if you may need it.
On a read-only connection you cannot make, rename, empty or drop anything here.
After a change made elsewhere
If another program made or dropped a table, press Reload the tables.