Inserting Data

This lesson teaches the various ways of inserting data in MySQL.

We'll cover the following

Insert Data

In the previous lessons we created our example table, Actors. But a table without any data is not very useful. In this lesson we’ll learn how to add data into a table using the INSERT statement. We’ll retrieve the added rows using the SELECT keyword. We’ll learn more about using SELECT in the next lesson, but for now, it suffices to know that it is used for retrieving rows from a table.

Example Syntax

INSERT INTO table (col1, col2 … coln)

VALUES (val1, val2, … valn);

Connect to the terminal below by clicking in the widget. Once connected, the command line prompt will show up. Enter or copy and paste the command ./DataJek/Lessons/7lesson.sh and wait for the MySQL prompt to start-up.

Level up your interview prep. Join Educative to access 80+ hands-on prep courses.