0% found this document useful (0 votes)
26 views

Write The SQL Statements For The Following Queries

Uploaded by

Muhammad Faizan
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views

Write The SQL Statements For The Following Queries

Uploaded by

Muhammad Faizan
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Write the SQL statements for the following Queries:

List the name and hire date of anyone with sales over 50000.
Query:
Select SapRepName,HireDate
from SalesRep
where Sales>50000;

Show me the result if I raised each Person’s quota by 3% of their year to date
sales.
Query:
Update SalesRep
Set Quota=Quota+(Sales*0.03);
Select * from SalesRep;

List the office whose sales fall below 80% of Target.


Query:
Select OfficeId,City,Region
From Office
Where Sales<(0.8*_Target);
List sales people whose sales are not between 80% and 120% of the Target.
Query:
Select SapRepName
From SalesRep
Where Sales<0.8*_Target OR Sales>1.2*_Target;
List all the customers whose name starts with ‘A’ or ‘a’.
Query:
Select Customername
from Customer
Where Customername like 'A%' OR Customername like 'a%';
List orders over 2500, including the name of the sales person who took the order
and names of the customer who placed it.
Query:
Select o.OrderId,s.SapRepName,c.CustomerName
From _Order o
Join SalesRep s ON o.SalRepId=s.SalRepId
Join Customer c ON o.CustomerId=c.CustomerId
where o.Amount>2500;

List the names of sales people and their managers.


Query:
Select SapRepName, Manager
From SalesRep;

You might also like