Solution to Activity 8.1
In this activity, you are tasked with adding new details to the existing country
table – that is, capital cities, countries' independence statuses, and currency types. Perform the following steps to accomplish this:
- Create a new script file named
Activity-MultipleUpdates.js
. - Add the connection module and instruct the server to use the
world_statistics
database. Include error handling:var mysqlconnection = require("./mysqlconnection.js") mysqlconnection.query("USE world_statistics", function (err, result) {
- Deal with the error, should one occur. Each distinct task performed by the code is embedded in the part of the
if
statement that is executed if there is no error. This means that, for each task to be performed, the preceding task must be error-free. If an error occurs in any given task, the script will report the error and then exit, and none of the following tasks will be attempted:if (err) throw "Instructing...