September 2010
Intermediate to advanced
440 pages
9h 23m
English
As you can see, inserting data into MySQL is a straightforward process that is largely based around ensuring that the database daemon knows where you want your data placed. Inserting data into MySQL may seem a bit more complicated than retrieving it but the previous discussion shows it is still logical, but just requires a few more keywords in order to be useful.
Using INSERT with MySQL for Python is just as easy as using SELECT. As we saw in the previous chapter, we pass the command to MySQL using the execute() method of the database cursor object.
We will again use the fish database and the menu table as follows:
+----+----------------+-------+ | id | name | price | +----+----------------+-------+ ...
Read now
Unlock full access