I am new to databases. I have an SQL database which looks a bit like this:
BEGIN;
CREATE TABLE "country" (
"id" integer NOT NULL PRIMARY KEY,
"name" varchar(255) NOT NULL
)
;
CREATE TABLE "location" (
"id" integer NOT NULL PRIMARY KEY,
"name" varchar(255) NOT NULL,
"coordinate" varchar(255) NOT NULL,
"country_id" integer NOT NULL REFERENCES "country" ("id")
)
;
CREATE TABLE "item" (
"id" integer NOT NULL PRIMARY KEY,
"title" varchar(25) NOT NULL,
"description" text NOT NULL,
"date" datetime NOT NULL,
"source" varchar(255) NOT NULL,
"link" varchar(255) NOT NULL,
"location_id" integer NOT NULL REFERENCES "location" ("id")
)
;
If I delete item entries from the database, and then add new item entries to the database, what happens about the items primary key? I mean, will it just increment, or will it fill in any gaps?
In my situation I cant keep unneeded entries in the database as "active=no" entries, I need to delete them completely, but I am concerned about it messing up the primary keys on the items.