Computer Science, asked by mrnrjv, 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 Datsum 1500000 26
W9760 SUV Maruti 2500000 18
R2409 Mini van Mahindra 350000 15

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

Answers

Answered by tripathiakshita48
0

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:

SELECT - extracts data from a database

UPDATE - updates data in a database

DELETE - deletes data from a database

INSERT INTO - inserts new data into a database

CREATE DATABASE - creates a new database

ALTER DATABASE - modifies a database

CREATE TABLE - creates a new table

ALTER TABLE - modifies a table

DROP TABLE - deletes a table

CREATE INDEX - creates an index (search key)

DROP INDEX - deletes an index

SQL stands for Structured Query Language

SQL lets you access and manipulate databases

SQL became a standard of the American National Standards Institute (ANSI) in 1986, and of the International Organization for Standardization (ISO) in 1987

SQL can execute queries against a database

SQL can retrieve data from a database

SQL can insert records in a database

SQL can update records in a database

SQL can delete records from a database

SQL can create new databases

SQL can create new tables in a database

SQL can create stored procedures in a database

SQL can create views in a database

SQL can set permissions on tables, procedures, and views

See more:

https://brainly.in/question/28847814

#SPJ1

Similar questions