Download presentation
Presentation is loading. Please wait.
Published byGodwin Anderson Modified over 9 years ago
1
Example 18 SELECT count(*) 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 SELECT RepNum, count(*) AS NumCustomer, Avg(Balance) AS AverageBalance FROM Customer GROUP BY RepNum HAVING Count(*)<4;
7
Example 23-1 SELECT RepNum, count(*) AS NumCustomer, Avg(Balance) AS AverageBalance FROM Customer WHERE CreditLimit<10000 GROUP BY RepNum HAVING Count(*)<3;
8
Example 24 SELECT CustomerNum, CustomerName, Rep.RepNum, LastName, FirstName FROM Customer, Rep WHERE Rep.RepNum=Customer.RepNum;
9
Example 25 SELECT CustomerNum, CustomerName, Rep.RepNum, LastName, FirstName FROM Customer, Rep WHERE Rep.RepNum=Customer.RepNum AND CreditLimit=10000;
10
Example 26 SELECT Orders.OrderNum, Orderdate, Customer.CustomerNum, CustomerName, Part.PartNum, Description, NumOrdered, QuotedPrice FROM Orders, Customer, OrderLine, Part WHERE Customer.CustomerNum=Orders.CustomerNum AND Orders.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');
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.