某数据库中有表Table_Good((GoodsID,GoodsName,SaleUnitPrice)和表Table_GoodsClass(GoodsClassI

12 查阅

某数据库中有表Table_Good((GoodsID,GoodsName,SaleUnitPrice)和表Table_GoodsClass(GoodsClassID,GoodsClassName,Sum),对家用电器类商品进行分类显示,如果商品的单价高于3000,则显示‘高档商品’;如果单价在1000-3000,则显示‘中档商品’;如果单价低于1000的显示‘低档商品’。完成下列的SQL语句。

SELECT GoodsName,SaleUnitPrice,Type=CASE

_______

______

______

END

FROM ______

ON _______

WHERE GoodsClassName=‘家用电器’

参考答案:

WHEN SaleUnitPrice>3000 THEN‘高档商品’WHEN SaleUnitPrice BETWEEN 1000 AND 3000 THEN‘中档商品’WHEN SaleUnitPrice1000 THEN‘低档商品’Table_Goods a JOIN Table_GoodsClass ba.GoodsID=b.GoodsClassIDWHEN SaleUnitPrice>3000 THEN‘高档商品’WHEN SaleUnitPrice BETWEEN 1000 AND 3000 T

计算机四级