Sql: how to copy from one table to another table

table structure is a subset of table B, this means that table A all columns are the first columns of table B, but table B has more columns than table A. My question is, what is the SQL file to copy all the rows from table A to table B ( missing columns in table B will be empty).

+7
sql sqlite
source share
1 answer

Using:

INSERT INTO TABLE_B SELECT col1, col2, col3, NULL FROM TABLE_A 

Use NULL as a placeholder for the number of columns that you cannot fill from TABLE_A, provided that the TABLE_B columns are nullable.

+18
source share

All Articles