(iii) Delete the record of products whose price is more than 500 and discount is less than 0.2

Answer:

Answer by student

The SQL query is:

DELETE FROM Product WHERE Price > 500 AND Discount < 0.2;

Detailed answer by teachoo

-lock-

  • To delete the record of products whose price is more than 500 and discount is less than 0.2, we need to use the DELETE statement with the FROM clause.
  • The FROM clause specifies the table name from which we want to delete rows.
  • We also need to use the WHERE clause to filter the rows that match the condition. The condition is that the price column should be greater than 500 and the discount column should be less than 0.2.

The SQL query for this is:

DELETE FROM Product WHERE Price > 500 AND Discount < 0.2;

This query will delete all rows from the table Product where price is more than 500 and discount is less than 0.2 and after the execution of the query, the table will look like this:

P_ID

Name

Category

Price

Discount

P01

Pen

Stationery

12

0.1

P02

Book

Stationery

50

NULL

P03

Shirt

Clothing

600

0.2

-endlock-

Remove Ads
Davneet Singh's photo - Co-founder, Teachoo

Made by

Davneet Singh

Davneet Singh is an IIT Kanpur graduate and has been teaching for 16+ years. At Teachoo, he breaks down Maths, Science and Computer Science into simple steps so students understand concepts deeply and score with confidence.

Many students prefer Teachoo Black for a smooth, ad-free learning experience.