SQL Assignment

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 1

Q1: Consider the following Company database, describing the data of customers orders:

CUSTOMER ( Cid, CName, City, Discount )


AGENT ( Aid, AName, City, Percent )
PRODUCT ( Pid, PName, City, Quantity, Price )
ORDERS ( OrderNo, Month, Cid, Aid, Pid, OrderedQuantity, Cost )

1) List the names of agents that placed an order for customer C003 or customer C006.

2) List all pair of products names that are in the same city, along with their city name.

3) List the number of orders and their total cost for each agent that handled orders with more than $1,000 in total ;
showing the agent name.

4) List the names of all customers and the total cost of their orders if they have placed an order.

5) List the id and the name of products that were not ordered through agents A04.

6) List the id of products ordered by any agent who makes at least one order for a customer in Kyoto.

7) List the id and discount percentage of customers who have the largest discount and those who have the smallest
discount.

8) List the id and name of agents with name beginning with the letter J or B and who do not place orders for a
Product located in Dallas.

9) List name of customers that ordered all the products.

10) Insert a new order for the customer that didnt have any orders; with 1030 as order number which has been
placed in November by agent number A01 for product number P06 with quantity of 90. Note: unknown values
have to be selected from existing data.

11) Decrease by 10% the price of all products located in Dallas.

12) Delete all orders placed by agents living in New York city.

You might also like