With SQL, you can copy information from one table to another.
The SELECT INTO statement copies data from one table and then inserts the data into a new table.
SQL SELECT INTO statement
The SELECT INTO statement copies data from one table and then inserts the data into another new table.
SQL SELECT INTO syntax
We can copy all columns and insert them into a new table:
//INTO newtable [IN externaldb]
//FROM table1;
Or just copy the desired columns and insert them into the new table:
INTO newtable [IN externaldb]
FROM table1;
## Tips: The new table will use the SELECT statement Create the column names and types defined in . You can use the AS clause to apply the new name. |
##SQL SELECT INTO Example
Create a backup copy of Customers:
SELECT *WHERE country='CN';
LEFT JOIN access_log
ON Websites.id=access_log.site_id;
The SELECT INTO statement can be used to create a new empty table through another schema. Just add a WHERE clause that causes the query to return no data:
SELECT *FROM table1
WHERE 1=0;












![Getting Started with PHP Practical Development: PHP Quick Creation [Small Business Forum]](https://img.php.cn/upload/course/000/000/035/5d27fb58823dc974.jpg)









