《Database System Concepts(数据库系统概念)》第六版——第三次作业(第三章)

这些SQL查询涉及多表连接(如JOIN),条件过滤(WHERE子句),聚合函数(COUNT,MAX,SUM),分组(GROUPBY)以及子查询,主要用于数据提取和分析,例如查找特定导师的学生,计算学分加权分数,评估成绩分布,贷款和银行信息,以及员工薪资比较。
摘要由CSDN通过智能技术生成

3.1

  • b

    select distinct student.ID
    from student natural join advisor,instructor
    where instructor.ID=advisor.i_id and instructor.name="Einstein"
    
  • e

    select course_id,sec_id,count(ID)
    from section natural join takes
    where year=2009 and semester="fall"
    group by course_id,sec_id
    
  • f

    select max(sum)
    from (select count(ID) as con
    	from section natural join takes
    	where year=2009 and semester="fall"
    	group by course_id,sec_id)
    
  • g

    select course_id,sec_id
    from section natural join takes
    where count(ID)=(select max(con)
    				from (select count(ID) ans con
    					from section natural join takes
    					where year=2009 and semester="fall"
    					group by course_id,sec_id)) and year=2009 and semester="fall"
    group by course_id,sec_id	)
    					)				
    

3.2

  • a

     select count(points*credits)
     from ((takes natural join course ) join grade_points using grade
     where ID=12345
    
  • b

     select sum(points*credits) / sum(credits)
     from ((takes natural join course ) join grade_points using grade
     where ID=12345
    
  • c

     select ID,sum(points*credits) / sum(credits)
     from ((takes natural join course ) join grade_points using grade
    group by ID
    

3.5

  • a

    select ID,
    	case 
    		when score<40 then 'F'
    		when score<60 then 'C'
    		when score<80 then 'B'
    		else 'A'
    		as grade
    from marks
    
  • b

    select grade,count(ID)
    from (select ID,
    	case 
    		when score<40 then 'F'
    		when score<60 then 'C'
    		when score<80 then 'B'
    		else 'A'
    		as grade
    	from marks)
    group by grade
    

3.8

  • a

    select customer_name
    from loan natural join borrower
    where amount=0
    
  • b

    select customer_name
    from customer
    where customer_street=(select customer_street from customer where customer_name="Smith") and customer_city=(select customer_city from customer where customer_name="Smith")
    
  • c

    select distinct branch_name
    from (account natural join depositor) join customer using customer_name
    where customer_city="Harrison"
    

3.9

  • a

    select employee_name,city
    from employee natural join works
    where company_name="First Bank Corporation"
    
  • b

    select employee_name,street,city
    from employee natural join works
    where company_name="First Bank Corporation" and salary>10000
    
  • c

    select employee_name
    from employee natural join works
    where company_name<>"First Bank Corporation"
    
  • d

    select employee_name
    from employee natural join works
    where  salary > all(select salary
    					from employee natural join works
    					where company_name="Small Bank Corporation")
    
  • e

    select company_name
    from company
    where city in (select city
    				from company
    				where company_name="Small Bank Corporation")
    
  • f

    select company_name
    from works
    where count(employee_name)=(select max(con)
    				from (select count(employee_name) as con
    					from works
                        group by company_name)
                          )
    
  • g

    select company_name
    from works
    group by company_name
    having avg(salary)>(select avg(salary)
    					from works
    					where company_name="First Bank Corporation")
    

3.14

  • a

    select damage_amount
    from participated join person
    where name="John Smith"
    
### 回答1: 《数据库系统概念(第七版)》是一本经典的数据库教材,由Silberschatz、Korth和Sudarshan合著。该书详细介绍了数据库系统的基本概念、数据模型、关系代数、SQL语言、事务管理、并发控制、数据安全等方面的知识。该书内容深入浅出,适合初学者和专业人士阅读。 ### 回答2: 《数据库系统概念》(Database System Concepts)7th是一本介绍数据库系统原理和设计以及应用的经典教材。本书通过详细阐述数据库的基本概念,包括数据模型、数据库语言和系统体系结构等方面,帮助读者理解数据库的工作原理及其所能提供的功能。 本书的第一部分介绍了数据管理的基础概念,包括数据模型、数据规范化和ER模型等。读者可以了解到数据库的基本组成部分和如何抽象表达数据。第二部分是关于数据库语言的介绍,其中包括SQL语言、关系代数和数据工具等。读者可以了解到各种不同类型的查询和如何从数据库中获取所需的信息。第三部分则涉及数据库的实现和应用部署,其中包括存储管理、查询优化和事务等。 此外,本书还介绍了现代数据库中的最新技术,例如数据挖掘、XML数据管理和NoSQL数据库等。对于想要深入了解互联网时代数据库技术的读者十分有用。 总的来说, 《数据库系统概念》(Database System Concepts)7th是一本权威经典的数据库教材,适用于计算机科学、计算机工程和信息管理等专业的本科生和研究生学习使用。同时,对于研究院所和企业等需要使用数据库的专业人员也十分有帮助。 ### 回答3: 《数据库系统概念》第七版是一本经典的数据库系统教材,由Abraham Silberschatz、Henry F. Korth、S. Sudarshan合著。本书共分为13章,内容包括关系数据模型、SQL、存储结构和文件组织、索引和查询处理、查询优化、事务管理、并发控制、数据库恢复、分布式数据库、NoSQL等方面。本书的目的是帮助读者建立数据库管理系统的基础知识,以及如何设计和实现数据库系统。 本书的重要特点是:清晰明了、深入浅出、注重理论和实践结合,并且紧密跟踪数据库技术的发展和变化。在本书中,作者为读者提供了大量具有实际应用价值的实例、案例和代码,帮助读者理解和掌握各种概念和方法。 本书首先介绍了关系数据模型及其基本概念,如关系、属性、域、元组、主键、外键等,在此基础上介绍了SQL语言及其语法、查询分析、查询优化和数据库设计过程。此外,本书还介绍了存储结构和文件组织的基本原理、索引和查询处理的算法和数据结构、事务管理、并发控制、数据库恢复和分布式数据库等方面的知识。 本书还特别介绍了NoSQL数据库的基础知识和应用场景,如键/值存储、文档存储和列式存储等,为读者提供了一个了解和掌握这一新型数据库技术的机会。 总之,《数据库系统概念》第七版是一本非常优秀的数据库系统教材,尤其适合计算机科学和工程领域的学生和研究人员使用。无论是从理论还是实践方面来看,都是非常重要和有价值的参考书。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值