文章目录
-
-
- 14.6.13 列出每个指定设施的预订总小时数 List the total hours booked per named facility
- 14.6.14 列出每位会员在 2012 年 9 月 1 日之后的首次预订 List each member’s first booking after September 1st 2012
- 14.6.15 生成成员名称列表,每行包含成员总数 Produce a list of member names, with each row containing the total member count
- 14.6.16 生成成员编号列表 Produce a numbered list of members
- 14.6.17 再次输出预订数量最多的设施 ID, Output the facility id that has the highest number of slots booked, again
- 14.6.18 按使用的(四舍五入)小时数对成员进行排名 Rank members by (rounded) hours used
- 14.6.19 查找前三大创收设施 Find the top three revenue generating facilities
- 14.6.20 按价值分类设施 Classify facilities by value
- 14.7 递归 Recursion
-
14.6.13 列出每个指定设施的预订总小时数 List the total hours booked per named facility
列出每个设施预订的总小时数,记住一个时段持续半小时。输出表应包含设施 ID、名称和预订时间,按设施 ID 排序。
SELECT f.facid, f.name, SUM(b.slots) * .5
FROM facilities AS f
INNER JOIN bookings AS b ON