首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > 其他数据库 >

not exists 运用

2012-08-22 
notexists 使用数据库题:有一学生表student(sid,sname)和一张图书借阅表books_loaned(sid,bname),请通过sq

not exists 使用

数据库题:有一学生表student(sid,sname)和一张图书借阅表books_loaned(sid,bname),请通过sql语句查找出从未借过一本书的学生的列表(请使用not?? exist关键字)

?


create table student
(
?sid int ,
?sname varchar(50)
)

create table books_loaned(
?sid int,
?bname varchar(50)
)

insert into student values(1,'ss')
insert into student values(2,'oo')
insert into student values(3,'dd')
insert into student values(4,'gg')
insert into student values(5,'qq')
insert into student values(6,'ee')
insert into student values(7,'aa')

insert into books_loaned values(1,'sddds')
insert into books_loaned values(6,'ee')
insert into books_loaned values(7,'aa')

?

select?? *?? from?? student?? a?? where?? not?? exists?? (select?? *?? from?? books_loaned b where?? a.sid=b.sid)

?

热点排行
Bad Request.