比较具体的问题是:
我在学习sql语言的时候,查询语句的用法有点让人困惑
select 列 from 表 where 条件select x.s#
from sc as x, sc as y
where x.s# = y.s# and x.c# = 'c2' and y.c# = 'c'这里的意思是搜索至少选修课程号为c2和c4的学生号。
为何需要sc X sc 操作?而且 x.s# = y.s#条件是什么意思?为何不可以:
select s#
from sc
where c# = 'c2' and c# = 'c'
---------------------------------------------------检索不学习c2课程的学生姓名和年龄select sname, age
from s
where not exists (select * from sc where sc.s# = s.s# and c# = 'c2')这里为何不可以:
select sname, age 
from s
where not exists (select * from sc where c# = 'c2')为何需要, sc.s# = s.s#?

解决方案 »

  1.   

    select s#
    from sc
    where c# = 'c2' and c# = 'c'--这是同时选修课程号为c2和c4的学生号
      

  2.   

    请问有什么好书?还有,请详细解析一下
    where x.s# = y.s# and x.c# = 'c2' and y.c# = 'c'
      

  3.   

    这是我从网上下的:
    E:\整理电子书\数据库 的目录2006-10-16  19:17    <DIR>          .
    2006-10-16  19:17    <DIR>          ..
    2006-10-16  19:17                 0 a.txt
    2006-10-14  20:34    <DIR>          oracle
    2006-07-20  20:40         1,279,478 Programming Microsoft SQL Server 2000 with XML.chm
    2006-09-16  23:48    <DIR>          SQL Server 2000 Developers Guide
    2006-09-23  09:19    <DIR>          sql server 2000实用教程
    2006-07-20  20:40        36,991,853 SQL Server 2000编程员指南.pdf
    2006-09-16  23:49    <DIR>          SQL server 2000自学教程(PDG)
    2006-07-20  20:40         4,756,398 sql server精华.chm
    2006-07-29  18:07           251,904 sql2000a1-overview.ppt
    2006-07-29  18:10            52,736 sql2000a10-performance.ppt
    2006-07-29  18:10           107,520 sql2000a11-transferdata.ppt
    2006-07-29  18:11           275,968 sql2000a12-replication.ppt
    2006-07-29  18:07           218,624 sql2000a2-install.ppt
    2006-07-29  18:08           112,128 sql2000a3-(t-sql).ppt
    2006-07-29  18:08            61,440 sql2000a4-dml.ppt
    2006-07-29  18:08           216,064 sql2000a5-database.ppt
    2006-07-29  18:09           310,784 sql2000a6-security.ppt
    2006-07-29  18:09           256,512 sql2000a7-backup.ppt
    2006-07-29  18:10           113,664 sql2000a8-restore.ppt
    2006-07-29  18:10           213,504 sql2000a9-task.ppt
    2006-04-19  14:07        90,108,781 SQL编程实用大全精华版.pdf
    2006-09-16  23:49    <DIR>          战胜SQL Server必做练习50题
    2006-09-16  23:49    <DIR>          数据库理论PPT
    2006-09-16  23:49    <DIR>          数据库系统设计(第七版)
    2006-07-20  20:40        12,721,565 轻松搞定 sql server 2000 程序设计.pdf
                  18 个文件    148,048,923 字节
                   9 个目录  1,445,650,432 可用字节
      

  4.   

    select x.s#
    from sc as x, sc as y
    where x.s# = y.s# and x.c# = 'c2' and y.c# = 'c'这里的意思是搜索至少选修课程号为c2和c4的学生号。
    为何需要sc X sc 操作?而且 x.s# = y.s#条件是什么意思?
    re:
    要将相同的两个表进行关联起进行查询为何不可以:
    select s#
    from sc
    where c# = 'c2' and c# = 'c'
    这是访问一个表,是同事学以和c的两门课程的学生信息