The below are the steps we need to follow. First, we need t create a new table.
CREATE TABLE DA31.TELE
(NAME2 VARCHAR(15) NOT NULL,
NAME1 VARCHAR(12) NOT NULL,
Now new Table TELE is created. I want to copy some old data into this new table.
INSERT INTO DA31.TELE
SELECT LASTNAME, FIRSTNME, PHONENO
WHERE WORKDEPT = ‘D21’;
Now Data is copied into new table.
The CREATE TABLE statement example creates a table which, at first, is empty. The table has columns for last names, first names, and phone numbers, but does not have any rows.
The INSERT statement fills the newly created table with data that is selected from the DA31.EMP table: the names and phone numbers of employees in department D21.
This way we can copy data from one table to another table. No need to use any Tool or load utility. This is simple sql query.