SELECT natname, sum(stkdiv*stkqty*exchrate) AS payment FROM stock JOIN nation
ON stock.natcode = nation.natcode
GROUP BY natname HAVING COUNT(*) >= 3;
SELECT natname FROM nation WHERE natname REGEXP '^United';
SELECT natname, stkfirm, stkqty FROM stock JOIN nation ON stock.natcode = nation.natcode
WHERE stkqty =
(SELECT MAX(stkqty) FROM stock
WHERE stock.natcode = nation.natcode);
CREATE VIEW divvalue (nation, firm, price, qty, exchrate, divpayment) AS SELECT natname, stkfirm, stkprice, stkqty, exchrate, stkdiv*stkqty*exchrate FROM stock JOIN nation ON stock.natcode = nation.natcode;
This page is part of the promotional and support material for Data Management (open edition) by Richard T. Watson |