Computer Science - Class 12
Solutions to CBSE Sample Paper - Computer Science Class 12

(ii)Display the name and price of products that belong to the category Electronics or Furniture.

Answer:

Answer by student

SELECT PName, Price FROM PRODUCT WHERE Category = ‘Electronics’ OR Category = ‘Furniture’; 

Detailed answer by teachoo

To display the name and price of products that belong to the category Electronics or Furniture, we need to use the SELECT statement in SQL . In this case, we want to select the PName and Price columns from the PRODUCT table . We also need to specify the condition that the Category column of the PRODUCT table is either Electronics or Furniture. We use the WHERE clause to specify the condition. We also use the OR operator to combine two conditions. So, we write:

SELECT PName, Price FROM PRODUCT WHERE Category = 'Electronics' OR Category = 'Furniture';

Go Ad-free
Davneet Singh's photo - Co-founder, Teachoo

Made by

Davneet Singh

Davneet Singh has done his B.Tech from Indian Institute of Technology, Kanpur. He has been teaching from the past 14 years. He provides courses for Maths, Science and Computer Science at Teachoo