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:
  1. Open the database containing the table.
  2. Click on Database Structure.
  3. Select the relevant table from the database by clicking on it.

    DB Browser for SQLite - Database 
Structure

  4. From the menu bar at the top of the window, select Edit and then Modify Table.
  5. Click on the Add field button.

    DB Browser for SQLite - Edit
table definition

  6. 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:

    DB Browser for SQLite - Add field

  7. 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:

  1. DB Browser for SQLite on OS X
  2. Adding a table to a database with DB Browser for SQLite

 

TechRabbit ad 300x250 newegg.com

Justdeals Daily Electronics Deals1x1 px