page73
55
CREATE OR REPLACE VIEW v_supplier_part COPY GRANTS
AS
SELECT p.p_name AS part_name,
p.p_retailprice AS retail_price,
ps.ps_supplycost AS supply_cost,
ps.ps_availqty AS available_quantity,
ps.ps_supplycost / ps.ps_availqty AS unit_price,
s.s_acctbal AS supplier_account_balance,
s.s_name AS supplier_name
FROM partsupp_baseline ps,
part_baseline p,
supplier_baseline s
WHERE ps.ps_partkey = p.p_partkey
AND ps.ps_suppkey = s.s_suppkey;
Then run a simple query to access
v_supplier_part
to produce a query profile.
SELECT part_name,
available_quantity AS avail_qty,
unit_price,
supplier_account_balance AS acct_bal,
supplier_name
FROM v_supplier_part
ORDER BY part_name ASC,
unit_price DESC
LIMIT 10;
Let’s examine the query profile; I showed you how to access the query profile earlier,
but as a quick reminder, Figure 3-6 shows the query and result set in context along with
highlighting the query ID, which should be clicked.
ChapTer 3
The Query profiler