The following Statement returns a List of Artist names and their track-names.
SELECT a.artistname, t.trackname
FROM artistname a, track t
WHERE a.artistid = t.trackartist;
Vra
I want to build a simple project with the following tables:
CREATE TABLE artist(
artistid INTEGER PRIMARY KEY,
artistname TEXT
);
CREATE TABLE track(
trackid INTEGER,
trackname TEXT,
trackartist INTEGER,
FOREIGN KEY(trackartist) REFERENCES artist(artistid)
);
I want my app to be user-friendly so how may I display the artistname instead of the artistid in the spinner of My Track Form? What SQLite statement should I use? After displaying all the artist names, what SQLite statement should I use to insert properly in my database?
Track Form Example:
Track Name: [EditText]
Artist: [Spinners]
Oplossing
The following Statement returns a List of Artist names and their track-names.
SELECT a.artistname, t.trackname
FROM artistname a, track t
WHERE a.artistid = t.trackartist;