sql statement a copy of the data table to another table

Assuming a copy of a table, a table b, want a data table to the table b.

Table 1. If a and b are the same table structure.

insert into b select * from a;

2. If a table structure and b is not the same table.

insert into b(col1, col2, col3, …) select a.col1, a.col2, a.col3, … from a where …;

3. If the table does not exist b.

select * into b from a;
select a.col1, a.col2, c.col3, ... into b from a;

 

"I wish I was just a baby, give sweets to laugh, cry and fell down Needless to disguise beyond recognition, not to suppress their feelings, smiled and said it does not matter, but often laugh more fun, the more my heart ache."

Guess you like

Origin www.cnblogs.com/yanggb/p/11129033.html