Answers for "How do i get 5 random rows from table in SQlite3?"

5

return random rows sqlite

// Use db.all()
let Query = `SELECT * FROM Table ORDER BY RANDOM() LIMIT 3;`
db.all(Query, (err, data) => {
    if (err) {
        console.log(err)
        return;
    }
    if (data) {
        console.log(data)
    } else {
        console.log("Not Enough Data")
    }
})
Posted by: Guest on July-24-2021

Code answers related to "How do i get 5 random rows from table in SQlite3?"

Code answers related to "Javascript"

Browse Popular Code Answers by Language