上回说到:《SQL必知必会》(17):创建和操纵表
文章目录
第十八课:使用视图
18.1 视图
视图是虚拟的表,举个栗子:
SELECT
cust_name,
cust_contact
FROM
Customers,
Orders,
OrderItems
WHERE
Customers.cust_id = Orders.cust_id
AND OrderItems.order_num = Orders.order_num
AND prod_id = 'RGAN01'
如果我们将以上查询封装成一个ProductCustomers表(虚拟的。并不是真实的表),再次查询的操作就变为:
select
cust_name,
cust_contact
from
Prod