Computer Science, asked by Akku39681, 5 months ago

A relation vehicles is given below: V_no Type Company Price Qty AW125 Wagon Maruti 250000 25 J0083 Jeep Mahindra 4000000 15 S9090 SUV Mitsubishi 2500000 18 M0892 Mini Van Datsun 1500000 26 W9760 SUV Maruti 2500000 18 R2409 Mini Van Mahindra 350000 15 Write sql commands to : A. Display the price of each type of vehicle having quantity more than 15. B. Dispaly the company name & qty from the table where company name starts with letter name ‘M’ C. Display the V_no & type and price in decending order.

Answers

Answered by hiteshpujari82
1

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;

Explanation:

Answered by HrishikeshSangha
0

The code for the three given parts A, B, and C are given below,

A. To display the price of each type of vehicle having a quantity of more than 15, you can use the following SQL command:

SELECT Type, Price

FROM vehicles

WHERE Qty > 15;

This will select the Type and Price columns from the vehicles table where the Qty column is greater than 15.

B. To display the company name and quantity from the table where the company name starts with the letter 'M', you can use the following SQL command:

SELECT Company, Qty

FROM vehicles

WHERE Company LIKE 'M%';

This will select the Company and Qty columns from the vehicles table where the Company column starts with the letter 'M'.

C. To display the V_no, Type, and Price in descending order, you can use the following SQL command:

SELECT V_no, Type, Price

FROM vehicles

ORDER BY Price DESC;

This will select the V_no, Type, and Price columns from the vehicles table and order them in descending order based on the Price column.

#SPJ3

Similar questions