YMatrix
Quick Start
Connecting
Benchmarks
Deployment
Data Usage
Manage Clusters
Upgrade
Global Maintenance
Expansion
Monitoring
Security
Best Practice
Technical Principles
Data Type
Storage Engine
Execution Engine
Streaming Engine(Domino)
MARS3 Index
Extension
Advanced Features
Advanced Query
Federal Query
Grafana
Backup and Restore
Disaster Recovery
Guide
Performance Tuning
Troubleshooting
Tools
Configuration Parameters
SQL Reference
Define a new table based on the query results.
[ WITH [ RECURSIVE ] with_query [, ...] ]
SELECT [ALL | DISTINCT [ON ( expression [, ...] )]]
* | expression [AS output_name] [, ...]
INTO [TEMPORARY | TEMP | UNLOGGED ] [TABLE] new_table
[FROM from_item [, ...]]
[WHERE condition]
[GROUP BY expression [, ...]]
[HAVING condition [, ...]]
[{UNION | INTERSECT | EXCEPT} [ALL | DISTINCT ] select]
[ORDER BY expression [ASC | DESC | USING operator] [NULLS {FIRST | LAST}] [, ...]]
[LIMIT {count | ALL}]
[OFFSET start [ ROW | ROWS ] ]
[FETCH { FIRST | NEXT } [ count ] { ROW | ROWS } ONLY ]
[FOR {UPDATE | SHARE} [OF table_name [, ...]] [NOWAIT]
[...]]
SELECT INTO creates a new table and fills the table with the data calculated by the query. Data is not returned to the client like a regular SELECT. The columns of the new table have the name and data type associated with the output column of SELECT.
SELECT Most parameters of INTO are the same as SELECT.
TEMPORARY
TEMP
UNLOGGED
new_table
Create a new table films_recent that contains only the latest entries in the table films:
SELECT * INTO films_recent FROM films WHERE date_prod >= '2016-01-01';
The SQL standard uses SELECT INTO to select values into scalar variables of the host program instead of creating a new table. The usage of SELECT INTO in YMatrix databases for table creation is historical. For this purpose, it is best to use CREATE TABLE AS in new applications.