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

233683__shahzaib database lab

The document contains a series of SQL query questions related to salespeople, customers, and orders. It includes tasks such as finding relationships between salespeople and customers, filtering orders based on amounts, and generating reports based on various criteria. Each question specifies the required output fields and conditions for the SQL queries.

Uploaded by

Salman Fareed
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

233683__shahzaib database lab

The document contains a series of SQL query questions related to salespeople, customers, and orders. It includes tasks such as finding relationships between salespeople and customers, filtering orders based on amounts, and generating reports based on various criteria. Each question specifies the required output fields and conditions for the SQL queries.

Uploaded by

Salman Fareed
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 20

Submit by:

Muhammad Shahzaib
Reg id:
233683
depaRtment:
BSSE 2nd semester
Submitted to:
Prof:Abdul Ghani
question 1: Find the salesperson and customer who reside
in the same city. Return Salesman, cust_name and city.
question 2: Find those orders where the order amount
exists between 500 and 2000. Return ord_no, purch_amt,
cust_name, city.

question 3: Find the salesperson(s) and the customer(s) he


represents. Return Customer Name, city Salesman,
commission.
Question 4: Find salespeople who received commissions of
more than 12 percent from the company.Return Customer
Name, customer city, Salesman, commission.
Question 5: Write a SQL query to locate those salespeople
who do not live in the same city where their customers live
and have received a commission of more than 12% from the
company. Return Customer Name, customer city, Salesman,
salesman city, commission.

Question 6: write a SQL query to find the details of an order.


Return ord_no, ord_date, purch_amt, Customer Name, grade,
Salesman, commission.
Question 7: Write a SQL statement to join the tables salesman,
customer and orders so that the same column of each table
appears once and only the relational rows are returned.
Question 8: Write a SQL query to display the customer name,
customer city, grade, salesman, salesman city. The results
should be sorted by ascending customer_id.
Question 9: Write a SQL query to find those customers with a
grade less than 300. Return cust_name, customer city, grade,
Salesman, salesmancity. The result should be ordered by
ascending customer_id.
Question 10 : Write a SQL statement to make a report with
customer name, city, order number, order date, and order
amount in ascending order according to the order date to
determine whether any of the existing customers have placed
an order or not.
Question 11 : SQL statement to generate a report with
customer name, city, order number, order date,order amount,
salesperson name, and commission to determine if any of the
existing customershave not placed orders or if they have placed
orders through their salesman or by themselves.

Question 12: Write a SQL statement to generate a list in


ascending order of salespersons who work either for one or
more customers or have not yet joined any of the customers.
Question 13: write a SQL query to list all salespersons along
with customer name, city, grade, order number, date, and
amount.
question 14: Write a SQL statement to make a list for the
salesmen who either work for one or more customers or yet to
join any of the customer. The customer may have placed, either
one or moreorders on or above order amount 2000 and must
have a grade,or he may not have placed and order to the
associated supplier.

Question 15: For those customers from the existing list who put
one or more orders, or which order have been placed by the
customer who is not on the list, create a report containing the
customer name, city, order number, order date, and purchase
amount.
Question 16: Write a SQL statement to generate a report with
the customer name, city, order no. orderdate, purchase amount
for only those customers on the list who must have a grade and
placed one
or more orders or which order(s) have been placed by the
customer who neither is on the list nor has a grade.
Question 17: Write a SQL query to combine each row of the
salesman table with each row of the customer table.
Question 18 : Write a SQL statement to create a Cartesian
product between salesperson and customer, i.e.each
salesperson will appear for all customers and vice versa for that
salesperson who belongs to that city.
Question 19 : Write a SQL statement to create a Cartesian
product between salesperson and customer, i.e. each
salesperson will appear for every customer and vice versa for
those salesmen who belong to a city and customers who
require a grade.
Question 20 : Write a SQL statement to make a Cartesian
product between salesman and customer i.e. each salesman
will appear for all customers and vice versa for those salesmen
who must belong to a city which is not the same as his
customer and the customers should have their own grade.
…………………….the end……

You might also like