2022年数据库实验三整理

上传人:hs****ma 文档编号:567483419 上传时间:2024-07-20 格式:PDF 页数:4 大小:376.76KB
返回 下载 相关 举报
2022年数据库实验三整理_第1页
第1页 / 共4页
2022年数据库实验三整理_第2页
第2页 / 共4页
2022年数据库实验三整理_第3页
第3页 / 共4页
2022年数据库实验三整理_第4页
第4页 / 共4页
亲,该文档总共4页,全部预览完了,如果喜欢就下载吧!
资源描述

《2022年数据库实验三整理》由会员分享,可在线阅读,更多相关《2022年数据库实验三整理(4页珍藏版)》请在金锄头文库上搜索。

1、实验 3:数据库的简单查询和连接查询一、实验目的熟练掌握和使用SQL Server 查询分析器的使用方法,加深对SQL 和 Transact-SQL语言的查询语句的理解。熟练掌握简单表的数据查询和数据排序的操作方法。二、实验内容1.数据表的导入和导出操作通过导入和导出功能实现数据表的转移和导入。2.简单查询操作。该实验包括投影、选择条件表达、数据排序等。三、实验步骤基本操作实验I :通过导入和导出功能实现数据表的转移和导入。步骤一 : 建立数据库和表,并数据步骤二:打开SQL Server 管理平台,展开服务器和数据库,右击该数据库图标,从弹出的快捷菜单中选择“任务导入数据”选项,启动数据导入

2、向导工具,就会出现欢迎使用向导对话框,对话框中列出了导入向导能够完成的操作。名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 1 页,共 4 页 - - - - - - - - - 步骤三:单击“下一步”按钮,则出现选择数据源对话框,在该对话框中,可以选择数据源类型、文件名、用户名和密码等选项。步骤四:导出成功基本操作实验II :简单查询实验1.To find all loan number for loans made at the Perryridge branch with lo

3、an amounts greater than $1200. 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 2 页,共 4 页 - - - - - - - - - select loan_number from loan where branch_name=Perryridge and amount 1200 2.Find the loan number of those loans with loan amounts between $900 and $1,500select l

4、oan number from loan where amount between 900 and 1500 3.Find the customer names and their loan numbers for all customers having a loan at some branch. select customer_name, T.loan_number, S.amount from borrower as T, loan as S where T.loan_number = S.loan_number 4. Find the number of tuples in the

5、customer relation select count (*) from customer 5. Find the number of depositors in the bank select count (distinct customer_name) from depositor 6. Find all customers who have both an account and a loan at the bank select distinct customer_name from borrower where customer_name in (select customer

6、_name from depositor ) 7. Find the number of depositors for each branch. select loan_number 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 3 页,共 4 页 - - - - - - - - - from loan where amount is null 8. Find all loan number which appear in the loan relation with null values for amountselect loan_number from loan where amount is null 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 4 页,共 4 页 - - - - - - - - -

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 建筑/环境 > 施工组织

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号