Solved 2025 Sample Question Paper CBSE Class 12 Computer Science (083) — Question 1
Back to all questionsConsider the table ORDERS as given below
| O_Id | C_Name | Product | Quantity | Price |
|---|---|---|---|---|
| 1001 | Jitendra | Laptop | 1 | 12000 |
| 1002 | Mustafa | Smartphone | 2 | 10000 |
| 1003 | Dhwani | Headphone | 1 | 1500 |
Note: The table contains many more records than shown here.
A) Write the following queries:
(I) To display the total Quantity for each Product, excluding Products with total Quantity less than 5.
(II) To display the orders table sorted by total price in descending order.
(III) To display the distinct customer names from the Orders table.
(IV) Display the sum of Price of all the orders for which the quantity is null.
OR
B) Write the output
(I) Select c_name, sum(quantity) as total_quantity from orders group by c_name;
(II) Select * from orders where product like '%phone%';
(III) Select o_id, c_name, product, quantity, price from orders where price between 1500 and 12000;
(IV) Select max(price) from orders;
(A)
(I)
SELECT Product, SUM(Quantity)
FROM ORDERS
GROUP BY Product
HAVING SUM(Quantity) >= 5;(II)
SELECT *
FROM ORDERS
ORDER BY Price DESC;(III)
SELECT DISTINCT C_Name
FROM ORDERS;(IV)
SELECT SUM(Price) AS Total_Price
FROM ORDERS
WHERE Quantity IS NULL;OR
(B)
(I) Select c_name, sum(quantity) as total_quantity from orders group by c_name;
+----------+----------------+
| c_name | total_quantity |
+----------+----------------+
| Jitendra | 1 |
| Mustafa | 2 |
| Dhwani | 1 |
+----------+----------------+
(II) Select * from orders where product like '%phone%';
+------+---------+------------+----------+-------+
| O_Id | C_Name | Product | Quantity | Price |
+------+---------+------------+----------+-------+
| 1002 | Mustafa | Smartphone | 2 | 10000 |
| 1003 | Dhwani | Headphone | 1 | 1500 |
+------+---------+------------+----------+-------+
(III) Select o_id, c_name, product, quantity, price from orders where price between 1500 and 12000;
+------+----------+------------+----------+-------+
| o_id | c_name | product | quantity | price |
+------+----------+------------+----------+-------+
| 1001 | Jitendra | Laptop | 1 | 12000 |
| 1002 | Mustafa | Smartphone | 2 | 10000 |
| 1003 | Dhwani | Headphone | 1 | 1500 |
+------+----------+------------+----------+-------+
(IV) Select max(price) from orders;
+------------+
| max(price) |
+------------+
| 12000 |
+------------+