Sample SQL statements
--List the names of customers in the US.
SELECT * FROM Customers
WHERE Country='Germany'
and city = 'Berlin'
-- List the supplier names in New Orleans.
Select SupplierName
from Suppliers
where city = 'New Orleans'
--List the products whose prices are higher than 60.
SELECT *
FROM Products
where price > 60
--List the Supplier IDs, Supplier names, and Product Prices of the products whose prices
are higher than 60.
SELECT [Link], SupplierName, ProductName, Price
FROM Suppliers S, Products P
where [Link] = [Link]
and Price > 60
--List the employees' names, customer names, city, and the country of the employees who
take care of customers in Portland, USA.
SELECT [Link], [Link], [Link], [Link], [Link], [Link]
FROM Employees E, orders O, Customers C
where [Link] = [Link]
and [Link] = [Link]
and [Link] = 'Portland'
and [Link] = 'USA'
--List the employee names and the number of customers in the US they serve.
SELECT [Link], [Link], [Link], count( [Link]) Num_Customers
FROM Employees E, orders O, Customers C
where [Link] = [Link]
and [Link] = [Link]
and [Link] = 'USA'
Group by [Link], [Link], [Link]
--List the names of the suppliers who supply products to the customers in the US.
Select [Link], [Link], [Link]
from Suppliers S, products P, OrderDetails OD, orders O, customers C
where [Link] = [Link]
and [Link] = [Link]
and [Link] = [Link]
and [Link] = [Link]
and [Link] = 'USA'
--List the suppliers and the number of customers they supply in the US, specifically those
with more than five customers.
Select [Link], count([Link]) C_Cname
from Suppliers S, products P, OrderDetails OD, orders O, customers C
where [Link] = [Link]
and [Link] = [Link]
and [Link] = [Link]
and [Link] = [Link]
and [Link] = 'USA'
group by [Link]
having count([Link]) > 5