Example 2 SELECT Customernum, CustomerName, Balance FROM Customer;
Example 3 SELECT * FROM Part;
Example 4 SELECT Customername FROM Customer WHERE CreditLimit=10000;
Example 5 SELECT Customer.CustomerNum FROM Customer WHERE Customer.CustomerNum='148';
Example 6 SELECT Customername FROM Customer WHERE City = ‘Grove';
Example 7 SELECT CustomerName, CustomerName, CreditLimit, Balance FROM Customer WHERE CreditLimit>Balance;
Example 8 SELECT Description FROM Part WHERE Warehouse=‘3’ AND OnHand>20;
Example 9 SELECT Description FROM Part WHERE Warehouse=‘3’ OR OnHand>20;
Example 10 SELECT Description FROM Part WHERE NOT Warehouse=‘3’;
Example 11 SELECT CustomerNum, CustomerName, Balance FROM Customer WHERE Balance BETWEEN 1000 AND 5000;
Example 12 SELECT CustomerNum, CustomerName, CreditLimit-Balance AS AvailableCredit FROM Customer;
Example 13 SELECT CustomerNum, CustomerName, CreditLimit-Balance AS AvailableCredit FROM Customer WHERE CreditLimit > Balance;
Example 14 SELECT CustomerNum, CustomerName, Street, City, State, Zip FROM Customer WHERE Street LIKE ‘*Oxford*’;
Example 15 SELECT CustomerNum, CustomerName, CreditLimit FROM Customer WHERE CreditLimit IN (7500, 10000, 15000);
Example 16 SELECT CustomerNum, CustomerName, CreditLimit FROM Customer ORDER BY CustomerName;
Example 17 SELECT CustomerNum, CustomerName, CreditLimit FROM Customer ORDER BY CreditLimit DESC, CustomerName;
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 WHERE PartNum IN (SELECT PartNum FROM Part WHERE Warehouse='3');
Example 22 SELECT RepNum, Count(*) AS NumOfCustomer, Avg(Balance) AS AvgBalance FROM Customer GROUP BY RepNum ORDER BY RepNum;
Example 23 SELECT Customer.RepNum, count(*) AS NumCustomer, Avg(Balance) AS AverageBalance FROM Customer GROUP BY Customer.RepNum HAVING Count(*)<4 ORDER BY Customer.RepNum;
Example 23-1 SELECT Customer.RepNum, count(*) AS NumCustomer, Avg(Balance) AS AverageBalance FROM Customer WHERE CreditLimit<10000 GROUP BY Customer.RepNum HAVING Count(*)<3 ORDER BY Customer.RepNum;
Example 24 SELECT CustomerNum, CustomerName, Rep.RepNum, LastName, FirstName FROM Customer, Rep WHERE Customer.RepNum=Rep.RepNum;
Example 25 SELECT CustomerNum, CustomerName, Rep.RepNum, LastName, FirstName FROM Customer, Rep WHERE Customer.RepNum=Rep.RepNum AND CreditLimit=10000;
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;
Example 27 SELECT CustomerNum, CustomerName FROM Customer WHERE RepNum='35' UNION SELECT Customer.CustomerNum, CustomerName FROM Customer, Orders WHERE Customer.CustomerNum=Orders.CustomerNum;
Example 28 UPDATE Customer SET Street = '1445 Rivard' WHERE CustomerNum='524';
Example 29 INSERT INTO Rep VALUES ('16', 'Rands', 'Shron', '826 Raymond', 'Altonville', 'FL', '32543', 0, 0.05);
Example 30 DELETE * FROM OrderLine WHERE PartNum='BV06';
Example 31 SELECT * INTO SmallCust FROM Customer WHERE CreditLimit<=7500;
Example 32 CREATE TABLE Employee; INSERT INTO Employee VALUES ('987654321', 'Choi', 'Yong', '9001 Stockdale', 'Bakersfield', 'CA', '123456789');