【Sql Server学习】Sql Server数据查询、数据更新、视图、权限管理

本文详细介绍了在Sql Server中如何进行数据查询、更新操作,包括查询选修特定课程的学生、数据插入与更新、集合运算以及视图的创建、修改与删除。同时,文章还探讨了权限管理,通过示例展示了用户权限的赋予、撤销和限制。
摘要由CSDN通过智能技术生成

1、数据查询:在学生-课程数据库中用SQL指令完成以下查询

(1)查询选修了所有课程的学生姓名。

 select sname from student

where not exists                            

(select * fromcourse

    where notexists                          

    (select*  from sc

       where sno=student.sno

           and cno=course.Cno))                    

(2)查询至少选修了学号为200215122的学生所选的所有课程的学生姓名。

select distinct sname

from student,sc

where not exists

    (select* from sc s1

       where s1.sno='200215122' and

       not exists

       (select* from sc s2

        where s2.sno=s1.sno and

              s2.cno=s1.cno))

(3)实现集合并运算,查询选修“数据库”课程或“信息系统”课程的学生学号。

select sno from sc

where cno =(select cno fromcourse where cname='数据库')

union

select sno from sc

where cno =(select cno fromcourse where cname='信息系统')

(4)实现集合交运算,查询既选修了“数据库”又选修了“信息系统”的学生学号。

select sno

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值