In this exercise you have to write SQL statements to query data from database tables.
Note: Download & execute the attached script in SQL Server to create database and tables for this exercise. Download script here
- Write a query to retrieve data from
Customers
table whoseContactTitle
isSales Manager
. - Write a query to retrieve data from
Customers
table whoseContactName
starts with letters
. - Write a query to retrieve data from
Customers
table who lives inLondon
,Paris
,Madrid
orSan Francisco
city. - Write a query to retrieve data from
Customers
table for all those customers who do not haveFax
number. - Write a query to retrieve data from
Customers
table arranged in alphabetical order based onContactName
. - Write a query to retrieve data from
Products
table to find how much totalUnitsInStock
you have from each Supplier. Group theSupplierID
and calculate the sum of correspondingUnitsInStock
for each supplier. Further filter the data to display records where SupplierID range between 10 to 30. - Write a query to retrieve data from
Products
table to show onlyProductID
,ProductName
,UnitPrice
&UnitsInStock
. Also show theTotalAmount
by multiplyingUnitPrice
withUnitsInStock
. - Write a query to retrieve data from
Products
table whereUnitsInStock
is greater than or equals to10
and less than equals to100
. - Write a query to retrieve data from
Products
table for all products withProductID
range between10
to20
. - Write a query to retrieve data from
Products
table whoseQuantityPerUnit
is inbottles
.