Example using last_insert_id.
Running MySQL query from the commandline.
Insert data into a second table from a first table.
Rename a table column.
Added a few more column altering commands that are useful.
Select year, month and average data. I used this for my weight tracking table.