???????
????????????????????????????????????????????????????????????????????????????????κ??л???????????????????????
???????????????
????1??????sql???
????2?????????sql?????????д??????????????????????????????????????????
????3????????????????????????
????4???????????????????????????????????????????????????????з????
????5??????????????????????????????????????????????????
????????????????????????????????????????????????????SELECT????????????????????????????????????????
????????????????????????????????洢??????????????á???????????????????????????????????????м?????????????????????Щ???е????????????????????????????
??????????????????????Щ??????????????
??????1?????????????????????
??????2???????????????????????????
??????3?????????????????????????????????Щ??????????????????????衣
??????4????????????????????????????????м????????????????????????
??????5?????DBMS????????????????ORDER BY???
??????6???е?DBMS?????????????????У?????????????Σ??????????????
??????7?????????????????????й??????????????????
??????8???е?DBMS?????????????????????????????????????????????????д??????
??????9???е?DBMS????????????????????????????е????в????????????????????
???????????
?????????CREATE VIEW???????????
??????DROP??????????????????DROP VIEW viewname;
??????????????????????
????CREATE VIEW ProductCustomers ASSELECT cust_name??cust_contact??prod_idFROM Customers??Orders??OrderItemsWHERE Customers.cust_id = Order.cust_id AND OrderItems.order_num = Order.order_num;
???????????????????ProductCustomers???????????????????????????????????????????п?????б??
????????????????RGAN01????
????SELECT cust_name??cust_contactFROM ProductCustomersWHERE prod_id = 'RGAN01';
?????????????????????????????
????????????????
????CREATE VIEW VendorsLocations ASSELECT RTRM(vend_name) || ' ( ' || RTRIM(vend_country) || ' ) ' AS vend_titleFROM Vendors;
???????????????????????
????????CustomerEMailList ???????????е???????????????
????CREATE VIEW CustomerEMailList ASSELECT cust_id?? cust_name?? cust_emailFROM CustomersWHERE cust_email IS NOT NULL;
??????????????????
???????????????????е??????????????????????
????CREATE VIEW OrderItemExpanded ASSELECT order_num?? prod_id?? quantity?? item_price?? quantity*item_price AS expanded_price
????FROM OrderItems;
???????????????????20008?????????
????SELECT *FROM OrderItemsExpandedWHERE order_num = 20008;