0% found this document useful (0 votes)
7 views1 page

sqlllll (1)

The document provides SQL commands for various operations on a 'product' table, including selecting specific columns, ordering records by price, calculating averages and totals, deleting records based on conditions, and updating specific entries. It covers ten different SQL queries to manipulate and retrieve data from the table. Each command is clearly stated with its intended operation and syntax.

Uploaded by

poojasaini989700
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)
7 views1 page

sqlllll (1)

The document provides SQL commands for various operations on a 'product' table, including selecting specific columns, ordering records by price, calculating averages and totals, deleting records based on conditions, and updating specific entries. It covers ten different SQL queries to manipulate and retrieve data from the table. Each command is clearly stated with its intended operation and syntax.

Uploaded by

poojasaini989700
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/ 1

Q1: Consider a table ‘product’ shown below.

Write a SQL command for the following


statements.

id Name Price quantity category


11 Pepsi 50 2 A
12 Biscuit 70 7 B
13 Cake 90 6 B
14 Chips 40 2 A
15 Toffee 50 8 C

(i) To display name and quantity.


Select name and quantity from product;

(ii) To display the records in ascending order of price.


Select * from product order by price;

(iii) To display the records in descending order of price.


Select * from product order by price desc;

(iv) To display average price.


Select avg(price) from product;

(v) To display total of the price.


Select sum(price) from product;

(vi) To delete the records whose price is less than 50.


Delete from product where price < 50;

(vii) To display lowest price.


Select min(price) from product;

(viii) To display highest price.


Select max(price) from product;

(ix) To display sum of price category wise.


Select category, sum(price) from product group by category;

(x) To change the name “biscuit” to “cherry”.


Update product set name=”cherry” where id=12;

You might also like