Adding a field to an SQLite table with DB Browser for
SQLite
If you wish to add a field, aka
column, to an existing table in a
SQLite
database, you can do so using DB Browser
for SQLite using the following steps:
-
Open the database containing the table.
-
Click on Database Structure.
-
Select the relevant table from the database by clicking on it.
-
From the menu bar at the top of the window, select Edit and then
Modify Table.
-
Click on the Add field button.
-
Scroll down to the bottom of the list of fields. You should see the new one
at the bottom. The default name will begin with "Field" followed by a number,
e.g., "Field12", if there were 11 fields already existing when it was created.
You can double-click on the name to change it and you can change the "type"
for the field from the default of INTEGER by selecting from the following
types from the drop down list for type:
- INTEGER
- TEXT
- BLOB
- REAL
- NUMERIC
-
The four check boxes to the right of "Type" are "Not null", though
you may only see "No" unless you click on the vertical line to the
right of the column header and drag it to the right, "PK" for primary
key, "AI" for autoincrement, and "U" for unique. If you hover the
mose pointer over the text for the column header, you will see the
full description for each one. If a field should not be allowed to
have a null value, i.e., should never be blank, check the "Not null"
check box. You will see the SQL command that creates the new table
and field(s) appear in a pane at the bottom of the Edit table
definition window. After making any needed change to "Name" and "Type",
and checking any boxes in the four column headers that follow them,
if needed, if you wish to change the location of the new field in the
table, you can relocate it in the table by clicking on the field to
highlight it and then clicking on the Move field up button.
If you don't need to add any other fields or make any other adjustments
to the table, you can click on the OK button.
See also:
- DB Browser for SQLite on
OS X
-
Adding a table to a database with DB Browser for SQLite