Sie sind auf Seite 1von 6

CH2-EX-QBE

Praneeth Reddy Seelam


ID:3911948
8. How many customers have a credit limit of $15,000?

SQL query:
SELECT Count(Customer.CustomerNum) AS CountOfCustomerNum
FROM Customer
HAVING (((Customer.CreditLimit)=15000));

Result:

We can also do it in design view as

CH2-EX-QBE
Praneeth Reddy Seelam
ID:3911948

10. Give the item number, description, and on-hand value (OnHand * Price) for each item in category
GME.

SQL query:
SELECT Item.ItemNum, Item.Description, [Item]![OnHand]*[Item]![Price] AS [on-hand value]
FROM Item
GROUP BY Item.ItemNum, Item.Description, Item.Category, [Item]![OnHand]*[Item]![Price]
HAVING (((Item.Category)="GME"));

CH2-EX-QBE
Praneeth Reddy Seelam
ID:3911948

Output:

14.Create a new table named Toy to contain the columns ItemNum, Description, OnHand, and Price for
all rows on
which the category is TOY.

SQL query:

SELECT item.ItemNum, [item].[Description] , [item].[OnHand] , item.Price INTO toy


FROM item where Category='toy';

CH2-EX-QBE
Praneeth Reddy Seelam
ID:3911948

Result:

15.In the Toy table, change the description of item DL51 to Classic Train Set.
SQL query:

UPDATE toy

CH2-EX-QBE
Praneeth Reddy Seelam
ID:3911948
SET toy.Description='Classic Train Set'
WHERE toy.ItemNum='DL51';

Output:

16. In the Toy table, delete every row on which the price is greater than $120.

SQLquery:
DELETE FROM toy

CH2-EX-QBE
Praneeth Reddy Seelam
ID:3911948
where toy.price > 120;

Result: