Mysql笔记1

1.Insert

INSERT INTO `mes`.`prc_operation_history`
(`factory_name`,
`name`,
`timekey`,
`create_time`,
`create_user`,
`last_event_time`,
`last_event_user`,
`type`)
VALUES
('Module',
'73000',
'2017/10/19/12/35',
'2017/10/19/12/35',
'admin',
'2017/10/19/12/35',
'admin',
'R');
View Code
 

 2.UpDate

update job_lot_history set last_event_name='trackin' where true=true;

update rtm_machine_history set machine_state_name='idel' where timekey='2017/10/20/13/12';

 3.Select

select * from job_lot_history;

 4.Create

create temporary table `job_product_history_temp` like `job_product_history`;

 5.Truncate

truncate job_product_history_temp;

 6.Drop

drop table job_product_history_temp;

 7.复制表以及表中内容

create temporary table `job_lot_history_temp` like `job_lot_history`;
insert into job_lot_history_temp (select * from job_lot_history);
update job_lot_history_temp set last_event_name = 'trackout' where true = true;
update job_lot_history_temp set timekey = date_add(timekey,interval  12 hour) where true = true;
insert into job_lot_history (select * from job_lot_history_temp);
select * from job_lot_history_temp
但愿人长久 千里共婵娟
原文地址:https://www.cnblogs.com/hellcats/p/7711975.html