1 / 16

Example 18

Example 18. SELECT count(*) FROM Part WHERE Class="HW";. Example 19. SELECT count(*), Sum(Balance) FROM Customer;. Example 20. SELECT count(*) AS CustomerCount, Sum(Balance) AS BalanceTotal FROM Customer;. Example 21. SELECT OrderNum FROM OrderLine

Download Presentation

Example 18

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Example 18 SELECTcount(*) FROM Part WHERE Class="HW";

  2. Example 19 SELECT count(*), Sum(Balance) FROM Customer;

  3. Example 20 SELECT count(*) AS CustomerCount, Sum(Balance) AS BalanceTotal FROM Customer;

  4. Example 21 SELECT OrderNum FROM OrderLine WHERE PartNum IN (SELECT PartNum FROM Part WHERE Warehouse='3');

  5. Example 22 SELECT RepNum, Count(*)AS NumOfCustomer, Avg(Balance) AS AvgBalance FROM Customer GROUP BY RepNum

  6. Example 23 SELECTRepNum, count(*) AS NumCustomer, Avg(Balance) AS AverageBalance FROM Customer GROUP BYRepNum HAVINGCount(*)<4;

  7. Example 23-1 SELECTRepNum, count(*) AS NumCustomer, Avg(Balance) AS AverageBalance FROM Customer WHERECreditLimit<10000 GROUP BYRepNum HAVINGCount(*)<3;

  8. Example 24 SELECT CustomerNum, CustomerName, Rep.RepNum, LastName, FirstName FROM Customer, Rep WHERERep.RepNum=Customer.RepNum;

  9. Example 25 SELECT CustomerNum, CustomerName, Rep.RepNum, LastName, FirstName FROM Customer, Rep WHERE Rep.RepNum=Customer.RepNum ANDCreditLimit=10000;

  10. Example 26 SELECTOrders.OrderNum, Orderdate, Customer.CustomerNum, CustomerName, Part.PartNum, Description, NumOrdered, QuotedPrice FROM Orders, Customer, OrderLine, Part WHERECustomer.CustomerNum=Orders.CustomerNumANDOrders.OrderNum=OrderLine.OrderNum AND OrderLine.PartNum=Part.PartNum;

  11. Example 27 SELECT CustomerNum, CustomerName FROM Customer WHERE RepNum='35' UNION SELECT Customer.CustomerNum, CustomerName FROM Customer, Orders WHERE Customer.CustomerNum=Orders.CustomerNum;

  12. Example 28 UPDATE Customer SET Street = '1445 Rivard' WHERE CustomerNum='524';

  13. Example 29 INSERT INTO Rep VALUES ('16', 'Rands', 'Shron', '826 Raymond', 'Altonville', 'FL', '32543', 0, 0.05);

  14. Example 30 DELETE * FROM OrderLine WHERE PartNum='BV06';

  15. Example 31 SELECT * INTO SmallCust FROM Customer WHERE CreditLimit<=7500;

  16. Example 32 INSERT INTO Employee VALUES('987654321', 'Choi', 'Yong', '9001 Stockdale', 'Bakersfield', 'CA', '123456789');

More Related