如果您无法下载资料,请参考说明:
1、部分资料下载需要金币,请确保您的账户上有足够的金币
2、已购买过的文档,再次下载不重复扣费
3、资料包下载后请先用软件解压,在使用对应软件打开
实验三:数据库综合查询一、实验目的掌握SELECT语句的基本语法和查询条件表示方法;掌握连接查询的表示及使用;掌握嵌套查询的表示及使用;二、实验环境已安装SQLServer2005企业版的计算机;三、实验内容以数据库原理实验1数据为基础,请使用T-SQL语句实现进行以下操作:查找出employee表中部门相同且住址相同的女员工的姓名、性别、职称、薪水、住址。selectx.emp_name,x.sex,x.title,x.salary,x.addrfromemployeexwheresex='F'andexists(select*fromemployeeywherey.addr=x.addrandy.sex='F'andy.dept=x.deptandy.emp_no<>x.emp_no);检索product表和sale_item表中相同产品的产品编号、产品名称、数量、单价。selectprod_id,prod_name,qty,unit_pricefromsale_item,productwhereprod_id=pro_id检索product表和sale_item表中单价高于2400元的相同产品的产品编号、产品名称、数量、单价。selectprod_id,prod_name,qty,unit_pricefromsale_item,productwhereprod_id=pro_idandunit_price>2400分别使用左向外连接、右向外连接、完整外部连接检索product表和sale_item表中单价高于2400元的相同产品的产品编号、产品名称、数量、单价。并分析比较检索的结果。selectprod_id,prod_name,qty,unit_pricefromsale_itemleftouterjoinproductonprod_id=pro_idwhereunit_price>2400selectprod_id,prod_name,qty,unit_pricefromsale_itemrightouterjoinproductonprod_id=pro_idwhereunit_price>2400selectprod_id,prod_name,qty,unit_pricefromsale_itemfullouterjoinproductonprod_id=pro_idwhereunit_price>2400由sales表中查找出销售金额最高的订单。selectmax(tot_amt)fromsales由sales表中查找出订单金额大于“E0013业务员在1996/10/15这天所接任一张订单的金额”的所有订单,并显示承接这些订单的业务员和该条订单的金额。selectsale_id,tot_amtfromsaleswheretot_amt>all(selecttot_amtfromsaleswheresale_id='E0001'andorder_date='2013-1-1')找出公司女业务员所接的订单。selectsales.*fromsales,employeewheresex='f'andemp_no=sale_id找出公司中姓名相同的员工,并且依据员工编号排序相识这些员工信息。selecta.*fromemployeea,employeebwherea.emp_name=b.emp_nameanda.emp_no<>b.emp_noorderbya.emp_no找出目前业绩未超过200000元的员工。selectsale_idfromsalesawhere(selectsum(tot_amt)fromsalesbwherea.sale_id=b.sale_id)<20000