1、创建测试表,
create table test_tbl_1(id varchar2(20),name varchar2(20))
create table test_tbl_2(name varchar2(20))
2、插入测试数据;
insert into test_tbl_1 values (1,'张三')
insert into test_tbl_1 values (2,'王二')
insert into test_tbl_1 values (3,'李四')
insert into test_tbl_1 values (4,'赵五')
insert into test_tbl_2 values ('张三')
insert into test_tbl_2 values ('王五')
insert into test_tbl_2 values ('李四')
insert into test_tbl_2 values ('马六')
commit
3、查询test_tbl_1表中全量数据;select t.*, rowid from test_tbl_1 t
4、编写语句,从表2的姓名列,找到跟表1姓名列相同的项;
select * from test_tbl_1 where name in (select name from test_tbl_2)
1.sql查询某张表中某一列的重复数据
select 字段name from 表A where 字段name in (select 字段name from 表A group by 字段name having count(字段name)>1) order by 字段name
2.sql 替换某一列的某几个值
update 表名 set 字段名 =replace(原字段名,被替换前的数值,替换后的数值)
例子:
update 表A set age = replace(age,18,20)
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)