Writing data to a database
Having extracted data from a database, the obvious next step is to put it back in. In the real world, we might come across this scenario when we need to exchange data between one application and another. A common way of facilitating this exchange is to extract some data out of an application database A, write it to a file, then take the same file, and import it into an application database B. As different applications (often from different vendors) are unlikely to be integrated at the application or at the database level, this intermediate step provides a bridge between one application and another.
Tip
A word of caution before we proceed. In real-life scenarios, we should be cautious about writing data directly to a database. There is something quite final and irreversible about this sort of process and that is one of the reasons why so many applications have data import Application Programming Interfaces (APIs). APIs provide a measure of protection for the underlying...