CS 425 – Database Organization - Homework 2

这篇博客是关于CS 425课程的数据库组织作业,要求使用关系代数解决与预订、订单和餐厅相关的问题,如查询特定餐厅的菜品价格、未被点过的菜品、预订总数等。
摘要由CSDN通过智能技术生成

Submission: Individual effort and submit
提交:个人努力和提交
Instructions: Try to answer all the questions using what you have learned in class. Please make your query general not data related
尝试用你在课堂上学到的知识来回答所有的问题。请让您的查询一般不涉及数据

Menu
在这里插入图片描述
Reservation/Booking预定
在这里插入图片描述
Orders 订单
在这里插入图片描述
Restaurant 餐厅
在这里插入图片描述

Question 1 (3 Points)
Write a relational algebra expression that returns the plate that was ordered from Chipotle along
with their price.
第1题(3分)
编写一个关系代数表达式,返回从Chipotle订购的盘子及其价格。

Question 2 (2.25 Points)
Write a relational algebra expression that returns the name of
each of the 3 stars restaurants along with the plate that has never been ordered from these
restaurants.
写一个关系代数表达式,返回每一家三星餐厅的名字以及从未在这些餐厅点过餐的盘子
餐馆。

Question 3 (1.75 Points)
Write a relational algebra expression that returns the name of the
plate that has never been ordered.
问题3(1.75分)写一个关系代数表达式,返回从未订购过的盘子的名称。

Question 4 (3.8 Points)
Write a relational algebra expression that returns the total number of reservations that are
reserved in a restaurant rated 4.
问题4(3.8分)
编写一个关系代数表达式,返回在等级为4的餐厅中预订的总数量。

Question 5 (4.5 Points)
Write a relational algebra expression that returns the name of the plate that has been ordered
more than 15 times in each restaurant.
问题5(4.5分)
写一个关系代数表达式,返回在每家餐厅订购超过15次的盘子的名称。

Question 6 (5.3 Points)
Write a relational algebra expression that returns the restaurant’s name with its average
plate price that is higher than the average of plate prices in all the restaurants.
问题6(5.3分)
写一个关系代数表达式,返回餐厅的名称,其平均餐盘价格高于所有餐厅餐盘价格的平均值。

Question 7 (4.5 Points)
Write a relational algebra expression that returns the bill (Σ𝑞𝑢𝑎𝑛𝑡𝑖𝑡𝑦 × 𝑝𝑟𝑖𝑐𝑒) for each reservation.
编写一个关系代数表达式,返回账单(∑)𝑞𝑢𝑎𝑛𝑡𝑖𝑡𝑦 × 𝑝𝑟𝑖𝑐𝑒) 每次预订。

Question 8 (4.5 Points)
Write a relational algebra expression that returns the number of the table that never been
reserved in each restaurant
编写一个关系代数表达式,返回每个餐厅中未被预订的表的编号。

Question 9 (5.3 Points)
Write a relational algebra expression that returns the name of the plate that has been ordered
the most from each restaurant.
编写一个关系代数表达式,返回每家餐厅被订购最多的盘子的名称。

Question 10 (5.3 Points)
Write a relational algebra expression that returns the total number of orders placed in each
restaurant between 02/20/2022 and 02/25/2022
编写一个关系代数表达式,返回在02/20/2022和02/25/2022之间在每家餐厅下的订单总数

Question 11 (6 Points)
Write a relational algebra expression that returns the average cost of plates for each restaurant
based on its rating.
编写一个关系代数表达式,根据餐厅的评级返回每家餐厅盘子的平均成本。

Question 12 (3.8 points)
Write a relational algebra expression that returns the most expensive plate (average plate price
is the highest) in each area (use Zip Code)
编写一个关系代数表达式,返回每个地区(使用邮政编码)中最昂贵的盘子(平均盘子价格最高)。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值