SQLAssignment for Chapter 3
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.
- 1
- 粉丝: 0
- 资源: 8
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- zblog站群:zblog seo站群高收录排名全地域霸屏
- 【安卓毕业设计】数独联网对战APP源码(完整前后端+mysql+说明文档).zip
- 【安卓毕业设计】Android天气小作业源码(完整前后端+mysql+说明文档).zip
- 【安卓毕业设计】群养猪生长状态远程监测源码(完整前后端+mysql+说明文档).zip
- 【安卓毕业设计】奶牛管理新加功能源码(完整前后端+mysql+说明文档).zip
- C#.NET公墓陵园管理系统源码数据库 SQL2008源码类型 WebForm
- 作业这是作业文件这是作业
- 4353_135543959.html
- C#物联订单仓储综合管理系统源码 物联综合管理系统源码数据库 SQL2008源码类型 WebForm
- 2024年最新敏感词库(7万余条)