Unit 18Using a MySQL Database: Command Line

MySQL supports five basic database operations: insertion, deletion, mutation, selection, and join. They are used to populate database tables and modify and retrieve the existing data. These operations would normally originate in your data analysis program, but to get the sense of them, we will first practice them at the mysql command-line prompt.

Insertion

First things first. We’ll insert a new record into a table, and then another one, and another one, until the table has all observations:

 INSERT​ ​INTO​ employee ​VALUES​(​NULL​,​NULL​,"John Smith",35000,NOW());
=> Query OK, 1 row affected, 1 warning (0.18 sec)

The first two NULLs are placeholder values of the index and the timestamp. The server ...

Get Data Science Essentials in Python now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.