1.

A relation Vehicles is given below :V_no TypeCompanyPriceQtyAW125WagonMaruti25000025J0083JeepMahindra400000015S9090SUVMitsubishi250000018M0892Mini vanDatsun150000026W9760SUVMaruti250000018R2409Mini vanMahindra35000015Write SQLcommands to:a. Display the average price of each type of vehicle having quantity more than 20.b. Count the type of vehicles manufactured by each company.c. Display the total price of all the types of vehicles.

Answer»

a. select Type, avg(Price) from Vehicle group by Type having Qty>20;

b. select Company, count(distinct Type) from Vehicle group by Company;

c. Select Type, sum(Price* Qty) from Vehicle group by Type;



Discussion

No Comment Found

Related InterviewSolutions