5.1
CREATE VIEW ViewPractices5_1 AS SELECT
product_name,
sale_price,
regist_date
FROM
Product
WHERE
sale_price >= 1000
AND regist_date = '2009-09-20';
5.2
INSERT INTO ViewPractice5_1
VALUES
('刀子', 300, '2009-11-02');
报错
5.3
SELECT
product_id,
product_name,
product_type,
sale_price,
AVG(sale_price) AS sale_price_all
FROM
product;
5.4
CREATE VIEW AvgPriceByType AS SELECT
product_id,
product_name,
product_type,
sale_Price,
(
SELECT
avg(sale_price)
FROM
product AS p2
WHERE
p1.product_type = p2.product_type
) AS avg_sale_price
FROM
product AS p1;
网友评论