My question is about working with sqlite and android.
I have this app which will record locations, and for each location the user will be able to add photos.
I have table for
locations(loc_id INTEGER, longitude REAL ,latitude REAL)
which works perfectly fine. But I need to create second one which is photos. The photos table will hold the path name of the photo as a TEXT
. It must also have another field which refers to a specific location through the loc_id
as a foreign key. The thing is I do not know how to link up those two.
Any help greatly appreciated thanks !
CREATE TABLE locations(
loc_id INTTEGER PRIMARY KEY,
longitude REAL,
latitude REAL
);
CREATE TABLE photos(
photo_id INTEGER PRIMARY KEY,
path TEXT,
fk_location INTEGER,
FOREIGN KEY(fk_location) REFERENCES locations(loc_id)
);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With