You can see that for yourself in the HISTORY tab if you enable 'logging to HISTORY with batch jobs' in 'preferences'.
but basically it is as simple as (if we omit the charset and sql_mode related commands):
Code:
show create table `test1`.`mydb`;
use test2;
CREATE TABLE `mydb` // here goes what 'show crate table' returned
select * from `test1`.`p1a`;
insert into .. //repeated for each row with the data returned by the SELECT.
There are variations depending on whether the MySQL version has INFORMATION_SCHEMA (5.0 ++) or not.
However this shows only the SQL processed.
What is processed inside the SQLyog binary is not shown here.
You cannot do this with pure SQL only!