Lena has written a Go program that queries the albums table of the chinook.db. She has already created the required variables and also written the following raw SQL query to SELECT all the columns from the albums table:
...
func main() {
... // here Lena already created a DB object of 'chinook.db' with sql.Open()
rows, err := db.Query("SELECT albumid, title, artistid, name FROM albums")
if err != nil {
log.Fatal()
}
defer rows.Close()
var albumId, artistId int
var title string
// The selected code will go where the '?' signs are below:
for ? {
err := ?
if err != nil {
log.Fatal(err)
}
fmt.Println(albumId, title, artistId)
}
}
Your task is to help Lena select from below the piece of code that should go where the ? signs are.
The selected code must achieve the following: iterate over the rows and read the columns in every row into the variables.