一个。编写并执行CREATE VIEW命令以创建CONDO_FEES视图。
这是我写的代码:
CREATE VIEW CONDO_FEES AS
SELECT SQR_FT, AVG(CONDO_FEE) AS AVERAGE_FEE
FROM CONDO_UNIT
GROUP BY SQR_FT
ORDER BY SQR_FT;
这是我尝试的另一个:
CREATE VIEW CONDO_FEES (SQR_FT, AVERAGE_FEE) AS
SELECT SQR_FT, AVG(CONDO_FEE)
FROM CONDO_UNIT
GROUP BY SQR_FT
ORDER BY SQR_FT;
这并不是所有公寓的平均值。它只使用相同的平方英尺来平均公寓。示例:
Sqr_ft Average_fee
1100 300
550 150.5
300 100
550 150.5
500 130