有关面试经常考的sql语句

来源:互联网 发布:淘宝客服聊天记录技巧 编辑:程序博客网 时间:2024/05/16 12:51

这是t_user表的表结构

create table T_USER

(
  USERID   VARCHAR2(50) not null,
  USERNAME VARCHAR2(50),
  PASSWORD VARCHAR2(50)

)


1、上图是有关的数据,请删除表中重复的数据

delete from t_user t
where t.userid > any (select u.userid 
from t_user u
where t.username = u.username
and t.password = t.password) 

2、将t_user表里的数据插入到另一张表(chengji)里。

insert into chengji(name,kemu) select username,password from t_user




0 0
原创粉丝点击