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

Assignment 09

The document contains SQL queries for a database assignment involving orders, customers, and salespeople. It includes queries to list order numbers with customer names, retrieve salesperson and customer names for each order, find customers serviced by high-commission salespeople, and calculate commissions on orders from high-rated customers. Each query is structured to join relevant tables and filter results based on specified criteria.

Uploaded by

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

Assignment 09

The document contains SQL queries for a database assignment involving orders, customers, and salespeople. It includes queries to list order numbers with customer names, retrieve salesperson and customer names for each order, find customers serviced by high-commission salespeople, and calculate commissions on orders from high-rated customers. Each query is structured to join relevant tables and filter results based on specified criteria.

Uploaded by

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

Assignment 09

1) Write a query that lists each order number followed by the name of the customer who made
the order.

select Onum,Cname from orders as o,customers as c where o.cnum=c.cnum;


2) Write a query that gives the names of both the salesperson and the customer for each order
along with the order number.

select sname,cname,Onum,amt,odate,c.cnum,c.snum from orders as o,customers as


c,salespeople as s where o.cnum=c.cnum And o.snum=s.snum;

3) Write a query that produces all customers serviced by salespeople with a commission above
12%. Output the customer’s name, the salesperson’s name, and the salesperson’s rate of
commission

select cname,sname ,comm from customers c,salespeople s where c.snum=s.snum and


s.comm>0.12;
4) Write a query that calculates the amount of the salesperson’s commission on each order by
a customer with a rating above 100

select onum,c.rating ,o.amt*s.comm as "Commision Ammount" ,sname,cname from orders


as o,customers as c,salespeople as s where o.cnum=c.cnum and o.snum=s.snum and
c.rating>100;

You might also like