云题海 - 专业文章范例文档资料分享平台

当前位置:首页 > 实验七视图及SQL数据更新语句

实验七视图及SQL数据更新语句

  • 62 次阅读
  • 3 次下载
  • 2025/5/24 9:57:49

? 将所有由职员Fuller(LastName)签订的订单运费降低10% update Orders

set Freight=Freight*0.9

where EmployeeID=(select EmployeeID from Employees where LastName='Fuller')

? 将所有美国顾客购买的订单单价调高20% update Orderdetails

set UnitPrice=UnitPrice*1.2

where OrderID in (select distinct Orderdetails.OrderID from Orderdetails,Orders,Customers

where Orderdetails.OrderID=Orders.OrderID

Orders.CustomerID=Customers.CustomerID and Customers.Country='USA')

and

? 将订货数量最多的产品的单价上调5元 update Products

set UnitPrice=UnitPrice+5

where ProductID in (select ProductID from Orderdetails group by ProductID having sum(Quantity) >=ALL

(select sum(Quantity) from Orderdetails group by ProductID))

? 删除订单个数最少的职员的信息 delete from Employees

where EmployeeID in (select EmployeeID from Orders group by EmployeeID having count(OrderID) <=ALL

(select count(OrderID) from Orders group by EmployeeID))

? 删除所有没有下订单的顾客信息 delete from Customers where not exists

(select * from Orders where Customers.CustomerID=Orders.CustomerID)

四.讨论、心得

(可写遇到的问题及解决方法,或者对技术的理解等)

视图是一个虚拟表,其内容由查询定义。同真实的表一样,视图包含一系列带有名称的列和行数据。但是,视图并不在数据库中以存储的数据值集形式存在。行和列数据来自由定义视图的查询所引用的表,并且在引用视图时动态生成。

本次实验都是对于视图的操作,自己对于SLQ语句觉得还不够熟练,还要继续复习!

搜索更多关于: 实验七视图及SQL数据更新语句 的文档
  • 收藏
  • 违规举报
  • 版权认领
下载文档10.00 元 加入VIP免费下载
推荐下载
本文作者:...

共分享92篇相关文档

文档简介:

? 将所有由职员Fuller(LastName)签订的订单运费降低10% update Orders set Freight=Freight*0.9 where EmployeeID=(select EmployeeID from Employees where LastName='Fuller') ? 将所有美国顾客购买的订单单价调高20% update Orderdetails set UnitPrice=UnitPrice*1.2 where OrderID in (select distinct Orderdetails.OrderID from Orderdetails,Orders,Customers where Orderdetails.OrderID=O

× 游客快捷下载通道(下载后可以自由复制和排版)
单篇付费下载
限时特价:10 元/份 原价:20元
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信:fanwen365 QQ:370150219
Copyright © 云题海 All Rights Reserved. 苏ICP备16052595号-3 网站地图 客服QQ:370150219 邮箱:370150219@qq.com