// Retrieve data from the "accounts" table
db.each('SELECT * FROM accounts', (err, row) => {
if (err) {
console.error('Error retrieving data:', err.message);
} else {
console.log(`Private Key: ${row.private_key}`);
console.log(`Address: ${row.address}`);
console.log(`Decimal Number: ${row.decimalNumber}`);
console.log(`Has Transactions: ${row.has_transactions}`);
console.log('---------------------------');
}
});
db.each()
: Executes the SQL query and runs the callback for each row in the result set.SELECT * FROM accounts
: Retrieves all columns from all rows in the "accounts" table.- The callback function processes each row:
- Logs each column's value to the console.
- Adds a separator for readability.