I am new to javascript sqlite database. I have this code which open the database and retrieve rows. is there a functionality of moving to the
next and previous, first and last record. please help
next and previous, first and last record. please help
JavaScript:
const sqlite3 = require('sqlite3').verbose();
// open the database
let db = new sqlite3.Database('./mybook.db');
console.error(err.message);
console.log('Connected to the mybook database.');
db.serialize(() => {
db.each(`SELECT questions as question,
wronganswer as wronganser
FROM beginner`, (err, row) => {
if (err) {
console.error(err.message);
}
window.alert(row.no + "\t" + row.questions);
});
});
db.close((err) => {
if (err) {
console.error(err.message);
}
console.log('Close the database connection.');
});