Shiptoaddressid, Shipmethod, Subtotal, Taxamt, Freight) : Given
Shiptoaddressid, Shipmethod, Subtotal, Taxamt, Freight) : Given
ProductModel(ProductModelID, Name)
ProductDescription(ProductDescriptionID, Description)
Exercices
Q1:Show the first name and the email address of customer with CompanyName 'Bike World'
1. select firstname,emailaddress
from Customer
Q2:Show the CompanyName for all customers with an address in City 'Dallas'.
2.
a. first method
select AddressID companyname
Customer t1
where exists( select AddressID
from CustomerAddress t2
where t1.CustomerID = t2.CustomerID
and exists (select *
from Address t3
where t3.AddressID=t2.AddressID
and t3.city = 'dallas'))
b. second method
select distinct companyname,t3.city
from Customer t1 inner join CustomerAddress t2
on t1.Customerid= t2.Customerid
inner join Address t3
on t2.AddressID = t3.AddressID
where t3.city= 'dallas'
Q3-How many items with ListPrice more than $1000 have been sold?
on t1.ProductID= t2.ProductID
group by t1.productid
Q4- Give the CompanyName of those customers with orders over $100000. Include the subtotal
SELECT Distinct Cust.CompanyName,SUM(SOH.SubTotal+SOH.TaxAmt+SOH.Freight)
ON SOH.CustomerID = Cust.CustomerID
GROUP BY Cust.CompanyName
Q5- Find the number of left racing socks ('Racing Socks, L') ordered by CompanyName 'Riding
Cycles'