create table tb(col1 varchar(10),col2 int,col3 int,col4 int,col5 varchar(10),col6 varchar(10))
insert into tb select 'Y',10,5,123,'A','你好'
insert into tb select 'C',15,6,231,'A','你好啊'
insert into tb select 'C',15,5,321,'A','你好吗'
insert into tb select 'F',20,8,111,'A','你真的好'
select * from tb t where not exists(
select 1 from tb where col1=t.col1 and col3>t.col3
)
insert into tb select 'Y',10,5,123,'A','你好'
insert into tb select 'C',15,6,231,'A','你好啊'
insert into tb select 'C',15,5,321,'A','你好吗'
insert into tb select 'F',20,8,111,'A','你真的好'
select * from tb t where not exists(
select 1 from tb where col1=t.col1 and col3>t.col3
)
本文通过具体的SQL语句展示了如何创建表、插入数据以及使用NOT EXISTS子句进行筛选查询。示例中包含了不同条件的数据插入及复杂查询语句的用法。
1万+

被折叠的 条评论
为什么被折叠?



