请问在这个题中数据库的关系是什么意思关系sales(product,month,qty,total)记录了每种产品每月的销售数量(qty)和利润(profit).下面是表的示例:Product month qty profit Sardines April 16 40 Sardines May 14 35 Sardines June 34 75 Anchovies April 23 78 Anchovies May 12 40.8 Anchovies June 20 60.6 Herrings April 12 23.88 Herrings May 23 45.77 Herrings June 19 37.81 (1)针对题中的示例关系,写出下列SQL语句的查询结果.select s1.month,s1.product,s2.productfrom sales s1,sales s2where s1.month=s2.month and s1.qty>s2.qty and s1.profit

问题描述:

请问在这个题中数据库的关系是什么意思
关系sales(product,month,qty,total)记录了每种产品每月的销售数量(qty)和利润(profit).下面是表的示例:
Product month qty profit
Sardines April 16 40
Sardines May 14 35
Sardines June 34 75
Anchovies April 23 78
Anchovies May 12 40.8
Anchovies June 20 60.6
Herrings April 12 23.88
Herrings May 23 45.77
Herrings June 19 37.81
(1)针对题中的示例关系,写出下列SQL语句的查询结果.
select s1.month,s1.product,s2.product
from sales s1,sales s2
where s1.month=s2.month and s1.qty>s2.qty and s1.profit

s1,s2指的是同一张表sales,这个数据库的自连接的一种查询方法.
查询出相同月份销售数量(qty)较多但利润(profit)较少的情况下的月份,销售数量多利润少的产品,销售数量少利润多的产品