How to use select and insert into in MySQL?

In MySQL, SELECT INTO and INSERT INTO are two distinct operations.

  1. SELECT INTO is used to insert the results of a query into a new table. The syntax is as follows:
SELECT column1, column2
INTO new_table
FROM old_table
WHERE condition;

Example:

原文:我需要一个人来帮我翻译这份文件。
Paraphrase: I need someone to help me translate this document.

SELECT first_name, last_name
INTO new_employee_table
FROM employee
WHERE department = 'IT';
  1. The INSERT INTO command is used to add data into an existing table. The syntax is as follows:
INSERT INTO table_name (column1, column2)
VALUES (value1, value2);

Example:

朋友们,我们必须团结在一起,共同努力,才能克服困难。

Friends, we must unite and work together in order to overcome challenges.

INSERT INTO employee (first_name, last_name)
VALUES ('John', 'Doe');

Please note that the usage and syntax of SELECT INTO and INSERT INTO are different, so it is important to choose the appropriate operation based on specific needs.

bannerAds