BEGIN TRANSACTION;
CREATE TABLE IF NOT EXISTS "events" (
	"ID"	INTEGER UNIQUE,
	"name"	TEXT,
	"date"	TEXT,
	"organizer"	TEXT,
	PRIMARY KEY("ID")
);
CREATE TABLE IF NOT EXISTS "runs" (
	"id"	INTEGER UNIQUE,
	"event"	INTEGER,
	"name"	TEXT,
	"lk"	TEXT,
	"gk"	TEXT,
	FOREIGN KEY("event") REFERENCES "events"("ID"),
	PRIMARY KEY("id")
);
CREATE TABLE IF NOT EXISTS "results" (
	"id"	INTEGER,
	"event"	INTEGER,
	"run"	INTEGER,
	"rang"	TEXT,
	"stnr"	INTEGER,
	"teilnehmer"	TEXT,
	"hund"	TEXT,
	"verein"	TEXT,
	"f"	INTEGER,
	"vw"	INTEGER,
	"zf"	INTEGER,
	"zeit"	REAL,
	"gf"	REAL,
	"msek"	REAL,
	"bew"	TEXT,
	"punkte"	TEXT,
	PRIMARY KEY("id" AUTOINCREMENT),
	FOREIGN KEY("run") REFERENCES "runs"("id"),
	FOREIGN KEY("event") REFERENCES "events"("ID")
);
COMMIT;
