创建出满足下述三个条件的视图(视图名称为 ViewPractice5_1)。使用 product(商品)表作为参照表,假设表中包含初始状态的 8 行数据。 条件 1:销售单价大于等于 1000 日元。 条件 2:登记日期是 2009 年 9 月 20 日。 条件 3:包含商品名称、销售单价和登记日期三列。 对该视图执行 SELECT 语句的结果如下所示。 SELECT * FROM ViewPractice5_1; 执行结果 product_name | sale_price | regist_date --------------+------------+------------ T恤衫 | 1000 | 2009-09-20 菜刀 | 3000 | 2009-09-20
时间: 2023-08-15 19:21:09 浏览: 185
以下是创建视图 ViewPractice5_1 的 SQL 语句:
```
CREATE VIEW ViewPractice5_1 AS
SELECT product_name, sale_price, regist_date
FROM product
WHERE sale_price >= 1000 AND regist_date = '2009-09-20'
```
该视图满足了条件 1 和 2,筛选出了销售单价大于等于 1000 日元且登记日期是 2009 年 9 月 20 日的数据。同时,该视图包含了商品名称、销售单价和登记日期三列,满足条件 3。
执行 SELECT * FROM ViewPractice5_1;可以得到结果:
```
product_name | sale_price | regist_date
--------------+------------+------------
T恤衫 | 1000 | 2009-09-20
菜刀 | 3000 | 2009-09-20
```
阅读全文
相关推荐









