MySQL

MySQL INSERT INTO

In this tutorial, we are going to see how to insert data with MySQL. To insert data into a MySQL table you need to use the SQL command INSERT INTO.
 

Syntax:
INSERT INTO tableName (column1, column2, ...) VALUES (value1, value2, ...);
  • INSERT INTO tableName is the command that tells the MySQL server to add a new row to a table named tableName.
  • (column1, column2, …) specifies the columns to update.
  • VALUES (value1, value2, …) specifies the values to add.
 

Example:

Let’s take an example of using INSERT INTO statement to see how it works. For this we will use the “Clients” table.
 

 
The following statement inserts a new row in “Clients” table:

INSERT INTO Clients (ClientID, Name, Age, Address) VALUES (5, 'Yohan', 16, 'San Francisco');


 
Now, we are going to check if the row has been correctly inserted in “Clients” table.

SELECT * FROM Clients;


 

mcqMCQPractice competitive and technical Multiple Choice Questions and Answers (MCQs) with simple and logical explanations to prepare for tests and interviews.Read More

Leave a Reply

Your email address will not be published. Required fields are marked *