資料庫將一張表插入另一張表中

2021-06-22 10:00:59 字數 1271 閱讀 1776

1.將一張表的資料插入到另一張表中

insert into seckill_hjh (

id, code,

name,

drumbeating,

strat_time,

productid,

price,

amount,

pay_time,

num_once,

note,

statu,

cause,

userid,

check_user,

order_num,

pay_num,

carriage

) select

sys_guid(),/*dbms_random.value(40,90),隨機生成40~90的整數*/

se.code,

se. name,

se.drumbeating,

se.strat_time,

se.productid,

se.price,

se.amount,

se.pay_time,

se.num_once,

se.note,

se.statu,

se.cause,

se.userid,

se.check_user,

se.order_num,

se.pay_num,

se.carriage

from

seckill se

where

se.drumbeating > = to_date (

'2014-01-01 00:00:00',

'yy-mm-dd hh24:mi:ss'

)

1.將一張表的資料插入到另一張表中

同上1)表結構完全一樣

insert into 表1

select * from 表2

2)表結構不一樣(這種情況下得指定列名)

insert into 表(列名1,列名2,列名3)

select  列1,列2,列3 from 表2

1.將一張表的資料插入到另一張表中 同上

1)表結構完全一樣

insert into 表1

select * from 表2

2)表結構不一樣(這種情況下得指定列名)

insert into 表(列名1,列名2,列名3)

select  列1,列2,列3 from 表2

將一張表的資料插入另外一張表

表cmb send sms create table cmb send sms send id bigint 20 not null auto increment comment 主鍵id phone no varchar 32 not null comment 手機號碼 status varcha...

將一張表的查詢結果插入到另一張表

select into 和 insert into select 兩種表複製語句 2select into desttbl from srctbl34 insert into desttbl fld1,fld2 select fld1,5 from srctbl56 以上兩句都是將 srctbl 的...

mysql中實現在一張表中插入另一張

mysql在將一張表中的部分資料插入另一張表中分為兩種情況 1.兩張表中的字段相同 insert into 表一 select from 表2 where 條件 如果不想要某個字段重複的數,插入的sql語句如下 insert into 表一 select from 表二 where 表一的某個字段 ...