软件下载吧文章资讯

分类分类

SQL基础:T-SQL查询为何慎用IN和NOT IN详解

2024-02-08 11:17作者:下载吧

前言

今天突然想到之前在书上看到的一个例子,竟然想不起来了.

于是翻书找出来,测试一下.

— drop table father,son
create table father(fid int,name varchar(10),oid int)
create table son(sid int,name varchar(10),fid int)

insert into father(fid,name,oid)
values(1,’father’,5),(2,’father’,9),(3,’father’,null),(4,’father’,0)

insert into son(sid,name,fid)
values(1,’son’,2),(2,’son’,2),(3,’son’,3),(4,’son’,null),(5,’son’,null)

select * from father
select * from son

展开全部

相关文章

说两句网友评论
    我要跟贴
    取消