Fewpal
0 votes
143 views
in Information Technology by (47.4k points)
closed by

A relation Vehicles is given below :

V_no TypeCompanyPriceQty
AW125WagonMaruti25000025
J0083JeepMahindra400000015
S9090SUVMitsubishi250000018
M0892Mini vanDatsun150000026
W9760SUVMaruti250000018
R2409Mini vanMahindra35000015

Write 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.

1 Answer

+1 vote
by (46.2k points)
selected by
 
Best 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;

Welcome to Sarthaks eConnect: A unique platform where students can interact with teachers/experts/students to get solutions to their queries. Students (upto class 10+2) preparing for All Government Exams, CBSE Board Exam, ICSE Board Exam, State Board Exam, JEE (Mains+Advance) and NEET can ask questions from any subject and get quick answers by subject teachers/ experts/mentors/students.

Categories

...