Selecting, inserting, updating, and deleting data

Getting data into and out of our database tables and updating, and deleting data when necessary is where we will spend most of our time when working with MariaDB.

Inserting data

To put data into our database, we use the INSERT command. The basic syntax isas follows:

INSERT [INTO] <table_name> [(<column_name>[, column_name,...])]
{VALUES | VALUE}
({expression|DEFAULT},...)[,(...),...];

As with the CREATE TABLE command, the parts in angle brackets (<>) are what we'll replace with our own values. The square brackets ([]) are optional and the pipe character (|) means or. The curly brackets ({}) specify a section that is mandatory but for this there is a choice of the key word you can use. For example, ...

Get Getting Started with MariaDB now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.