数据结构与算法分析Java版练习2.1和2.2


  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Assignment for Chapter 3 作业内容: Q1. Consider the following bank database, where the primary keys are underlined, construct the following SQL queries for this relational database. branch(branch_name, branch_city, assets) customer (customer name, customer_street, customer_city) loan (loan number, branch_name, amount) borrower (customer name, loan number) account (account number, branch_name, balance ) depositor (customer name, account_number) a. Find all customers who have an account at all the branches located in “Brooklyn”. b. Find out the total sum of all loan amounts in the bank. c. Find the names of all branches that have assets greater than those of at least one branch located in “Brooklyn”. Q2. Consider the following database, where the primary keys are underlined, construct the following SQL queries for this relational database. employee (employee_name, street, city) works (employee_name, company_name, salary) company (company_name, city) manages (employee_name, manager_name) a. Find the names of all employees who work for First Bank Corporation. b. Find all employees in the database who live in the same cities as the companies for which they work. c. Find all employees in the database who live in the same cities and on the same streets as do their managers. d. Find all employees who earn more than the average salary of all employees of their company. e. Find the company that has the smallest payroll. Q3. Consider the following database, where the primary keys are underlined, construct the following SQL queries for this relational database. member(memb no, name, age) book(isbn, title, authors, publisher) borrowed(memb no, isbn, date) a. Print the names ofmemberswho have borrowed any book published by “McGraw-Hill”. b. Print the names ofmemberswho have borrowed all books published by “McGraw-Hill”. c. For each publisher, print the names ofmemberswho have borrowed more than five books of that publisher. d. Print the average number of books borrowed permember. Take into account that if an member does not borrow any books, then that member does not appear in the borrowed relation at all.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值