From The Document Foundation Wiki
Jump to navigation Jump to search

The primary key is autogenerated and the table contains data

Starting situation: non-continuous numbering
  • Create the following numbering: the table contains 20 rows, for example, removing the last row, restart numbering at 15.
Use the SQL command above, modifying the starting value to 15.
  • Completely renumber (changing the existing keys): use the "copy table" wizard.
Copy and paste the table or move it slightly with the mouse: the wizard will appear.
  1. Supply a new name for the table
  2. Choose the option Structure and Data, click on Next
  3. Select all the fields except the primary key
  4. Click on Create. LibreOffice will suggest creating a primary key: choose No
  5. The new table is created. Modify it by adding a primary key field, autogenerate the value, save.