Chapter 2. Simple Querying
Record retrieval is without doubt the most common activity employed with regard to MySQL and other relational databases. Like most computer programs, MySQL functions on the basis of being invoked with parameters and returning results in accordance with them. As we seen, Python acts as an intermediary to that process. We can use it to access MySQL, login, and connect to a database of our choice.
In this chapter, we will look at the following:
Forming a MySQL query directly
Passing a query to MySQL
User-defined variables in a MySQL query
Determining characteristics of a database and its tables
Changing queries dynamically, without user input
Working through each of these points will help you at the end of the chapter, when we get to the project: a command-line search tool.