>>INSERT INTO testProfile SELECT * FROM profile;
WE CAN ALSO INSERT SPECIFIC DATA FROM ANOTHER TABLE:
>>INSERT INTO testProfile SELECT null,first_name, last_name, email FROM profile WHERE id IN(1,4,6);
DESCRIPTION
We get the return data from the SELECT statement from the profile table, and we filter the return data in the WHERE clause where the id is IN(1,4,6). After that, we insert the return data from the SELECT statement into the testProfile table. We want to generate a new id in the testProfile table, so we need to assign the null value in the SELECT statement.
0 comments:
Post a Comment