Introduction
Sometimes you need to reingest all the data from one table to another. For example, you might want to reingest data from a staging table to a production table. This article shows how to do this using theINSERT INTO statement.
Example
Below is a simple example on how it works and how to test:- Create a sample database
- Create a sample table
- Insert some data into the source table
- Check the number of rows in the source table
- Create a new table with the same structure as the source table.
- Insert all rows from the source table to the target table.
- Check the number of rows in the target table
population to the target table.
- Insert all rows from the source table to the target table, including the new column. The population field is set to 0 for all rows.
- Check the data in the target table