databases
databases copied to clipboard
Week3 Exercise 3 improvements
By week 3 the students are used to work with the promisified execQuery.
The exercise could be upgraded so there are less questions about the weirdness / old school approach.
const execQuery = util.promisify(connection.query.bind(connection));
async function getPopulationFromCountry(name, code) {
// assuming that connection to the database is established and stored as conn
return execQuery(
`SELECT Population FROM `country` WHERE Name = '${name}' and code = '${code}'`
);
}