带有GROUP BY的SQL PRoblem [英] SQL PRoblem with GROUP BY

查看:78
本文介绍了带有GROUP BY的SQL PRoblem的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

项目(upc,title,type,category,company,year,sellPrice)

购买(receiptId,date,cid,name,card#,expire,expectedDate,deliveredDate)

PurchaseItem(receiptId,upc,数量)

存储(名称,upc,股票)


显示畅销商品:用户提供日期和数字,比如n。所有商店都会在当天打印出n个畅销商品的清单。对于每个畅销书,系统显示标题,公司,当前库存和销售的份数。输出应根据销售情况订购:最畅销的商品应该是第一个,第二个应该是最好的等等。


这是我的SQL代码:

展开 | 选择 | Wrap | 行号

解决方案

您好,


欢迎来到TSDN

请确保遵循发布指南什么时候你在论坛上发帖


谢谢

主持人



项目(upc,title,type,category,company,year,sellPrice)

购买(receiptId,date,cid,name,card# ,expire,expectedDate,deliverDate)

PurchaseItem(receiptId,upc,quantity)

存储(名称,upc,股票)


显示畅销商品:用户提供日期和数字,例如n。所有商店都会在当天打印出n个畅销商品的清单。对于每个畅销书,系统显示标题,公司,当前库存和销售的份数。输出应根据销售情况订购:最畅销的商品应该是第一个,第二个应该是最好的等等。


这是我的SQL代码:

展开 | 选择 | Wrap | 行号



项目(upc,title,type,category,company,year, buyPrice)

购买(receiptId,date,cid,name,card#,expire,expectedDate,deliverDate)

PurchaseItem(receiptId,upc,quantity)

存储(名称,upc,股票)


显示最畅销item:用户提供日期和数字,比如n。所有商店都会在当天打印出n个畅销商品的清单。对于每个畅销书,系统显示标题,公司,当前库存和销售的份数。输出应根据销售情况订购:最畅销的商品应该是第一个,第二个应该是最好的等等。


这是我的SQL代码:

展开 | 选择 | Wrap | 行号


Item (upc, title, type, category, company, year, sellPrice)
Purchase (receiptId, date, cid, name, card#, expire, expectedDate, deliveredDate)
PurchaseItem (receiptId, upc, quantity)
Stored (name, upc, stock)

To show top selling item: The user provides a date and a number, say n. The system prints a list of the n best selling items on that day, by all the stores. For each best seller, the system shows the title, the company, the current stock and the number of copies sold. The output should be ordered according to sales: the best selling item should be first, the second best will follow, etc.

Here is my SQL code:

Expand|Select|Wrap|Line Numbers

解决方案

Hi,

Welcome to TSDN

Please make sure you follow POSTING GUIDELINES when ever you post in the forum

Thanks
MODERATOR


Item (upc, title, type, category, company, year, sellPrice)
Purchase (receiptId, date, cid, name, card#, expire, expectedDate, deliveredDate)
PurchaseItem (receiptId, upc, quantity)
Stored (name, upc, stock)

To show top selling item: The user provides a date and a number, say n. The system prints a list of the n best selling items on that day, by all the stores. For each best seller, the system shows the title, the company, the current stock and the number of copies sold. The output should be ordered according to sales: the best selling item should be first, the second best will follow, etc.

Here is my SQL code:

Expand|Select|Wrap|Line Numbers


Item (upc, title, type, category, company, year, sellPrice)
Purchase (receiptId, date, cid, name, card#, expire, expectedDate, deliveredDate)
PurchaseItem (receiptId, upc, quantity)
Stored (name, upc, stock)

To show top selling item: The user provides a date and a number, say n. The system prints a list of the n best selling items on that day, by all the stores. For each best seller, the system shows the title, the company, the current stock and the number of copies sold. The output should be ordered according to sales: the best selling item should be first, the second best will follow, etc.

Here is my SQL code:

Expand|Select|Wrap|Line Numbers


这篇关于带有GROUP BY的SQL PRoblem的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆