I am looking at some database tables which are defined like this:
This is the first table-
CREATE TABLE Point
(
Position integer unique not null,
Name text not null,
);
And second table is like this:
CREATE TABLE namesPerPoint
(
PointKey integer not null, -- unique ROWID in points table
name text unique not null
);
Now, my question is how will sqlite db know that PointKey references rowid in Positions table. Its just mentioned here in comment, for user convenience. If I myself have to do it, I will do using FOREIGN KEY constraint.
So, is this syntax correct? But this is a part of big successfully running system and all tables are defined like this only. So, I am assuming I am missing something.
Thanks
No, unless you create a foreign key constraint. but first, you need to
turn onthe foreign key supportadd a primary key to the main table
then to add foreign key
PRIMARY KEY
Source: SQLite Foreign Key Support