Take the following tables
CREATE TABLE album(
id SERIAL PRIMARY KEY NOT NULL,
duration INTEGER NOT NULL
);
CREATE TABLE genre(
id SERIAL PRIMARY KEY NOT NULL,
name VARCHAR(32) NOT NULL
);
CREATE TABLE album_genre(
album_id REFERENCES album(id),
genre_id REFERENCES genre(id)
);
I have the following data to be inserted
const album = {
duration: 12345
genre1Id: 1,
genre2Id: 2,
genre3Id: 3
}
How could I construct a SQL query that inserts the album data and then inserts into album_genre
using the genre id's and the inserted album's id