0% found this document useful (0 votes)
5 views3 pages

Assignment 19

The document outlines SQL commands to create various views in a database. It includes creating a view for customers with the highest rating, counting salespeople by city, calculating average and total orders for each salesperson, and a mention of a view for salespeople with multiple customers. Specific SQL syntax is provided for each view creation.

Uploaded by

omkar01mescoe
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views3 pages

Assignment 19

The document outlines SQL commands to create various views in a database. It includes creating a view for customers with the highest rating, counting salespeople by city, calculating average and total orders for each salesperson, and a mention of a view for salespeople with multiple customers. Specific SQL syntax is provided for each view creation.

Uploaded by

omkar01mescoe
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Assignment19

1) Create a view that shows all of the customers who have the highest rating.

D5_89775_Omkar>create view v1 as select * from customers where rating=(select max(rating) from


customers);

D5_89775_Omkar>select * from v1;


2) Create a view that shows the number of salespeople in each city.

D5_89775_Omkar>create view v2 as select city,count(snum) as "No of Salespeople" from


salespeople group by city;

D5_89775_Omkar>select * from v2;

3) Create a view that shows the average and total orders for each salesperson after his or her name.
Assume all names are unique.

create view v3 as select sname "Salespeople_Name",total_orders,average from salespeople, (select


snum,count(onum) "total_orders",avg(amt) "Average" from orders group by snum) as abcd where
salespeople.snum=abcd.snum;
4) Create a view that shows each salesperson with multiple customers.

You might also like