mysql SELECT INTO statement


  Translation results:

select

UK[sɪˈlekt] US[sɪˈlɛkt]

vt.Select; select; select

adj. Selected; select out; selective; picky, picky

Third person singular: selects Present participle: selecting Past tense: selected Past participle: selected

into

UK[ˈɪntə] US[ˈɪntu]

prep. (Indicates direction) enters...; (indicates belonging) input; (indicates status) enters... state; ( indicates time) lasts until

mysql SELECT INTO statementsyntax

Function: Used to create a backup copy of the table.

Syntax: SELECT * INTO new_table_name [IN externaldatabase] FROM old_tablename

Description: SELECT INTO statement selects data from a table, and then Data is inserted into another table. The SELECT INTO statement is often used to create a backup copy of a table or to archive records.

mysql SELECT INTO statementexample

//制作 "Persons" 表的备份复件
SELECT * INTO Persons_backup FROM Persons;
//通过从 "Persons" 表中提取居住在 "Beijing" 的人的信息,创建了一个带有两个列的名为 "Persons_backup" 的表
SELECT LastName,FirstnameINTO Persons_backup FROM Persons WHERE City='Beijing';
//创建一个名为 "Persons_Order_Backup" 的新表,其中包含从 Persons 和 Orders 两个表中取得的信息
SELECT Persons.LastName,Orders.OrderNoINTO Persons_Order_Backup FROM Persons INNER JOIN OrdersON Persons.Id_P=Orders.Id_P;

Popular Recommendations

Home

Videos

Q&A