首页 > 数据库技术 > 详细

sql 语句

时间:2019-02-03 11:34:40      阅读:135      评论:0      收藏:0      [点我收藏+]

批量插入数据:

insert into actor(actor_id,first_name,last_name,last_update)
values(1,‘PENELOPE‘,‘GUINESS‘,‘2006-02-15 12:34:33‘),
(2,‘NICK‘,‘WAHLBERG‘,‘2006-02-15 12:34:33‘);

 

删除emp_no重复的记录,只保留最小的id对应的记录。

CREATE TABLE IF NOT EXISTS titles_test (
id int(11) not null primary key,
emp_no int(11) NOT NULL,
title varchar(50) NOT NULL,
from_date date NOT NULL,
to_date date DEFAULT NULL);

delete 
from  titles_test 
where id not in (
    select min(id) from titles_test
    group by emp_no
)

 

sql 更新操作

update titles_test
set  from_date = ‘2001-01-01‘,to_date = NULL
where to_date = ‘9999-01-01‘

 

 

sql 语句

原文:https://www.cnblogs.com/lijins/p/10349893.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!