Class - 12 CBSE Computer Science Important Output Questions 2025
Give output for following SQL queries as per given table(s) :
Table : ITEM
I_ID | ItemName | Manufacturer | Price |
---|---|---|---|
PC01 | Personal Computer | ABC | 35000 |
LC05 | Laptop | ABC | 55000 |
PC03 | Personal Computer | XYZ | 32000 |
PC06 | Personal Computer | COMP | 37000 |
LC03 | Laptop | PQR | 57000 |
Table : CUSTOMER
C_ID | CustomerName | City | I_ID |
---|---|---|---|
01 | N Roy | Delhi | LC03 |
06 | H Singh | Mumbai | PC03 |
12 | R Pandey | Delhi | PC06 |
15 | C Sharma | Delhi | LC03 |
16 | K Agarwal | Bangalore | PC01 |
(i) SELECT DISTINCT City FROM Customer ;
(ii) SELECT ItemName, MAX(Price), Count(*)
FROM Item GROUP BY ItemName ;
(iii) SELECT CustomerName, Manufacturer
FROM Item, Customer
WHERE Item.I_ID = Customer.I_ID ;
(iv) SELECT ItemName, Price * 100
FROM Item WHERE Manufacturer = 'ABC' ;
SQL Queries
1 Like
Answer
(i)
Output
+-----------+
| City |
+-----------+
| DELHI |
| MUMBAI |
| BANGALORE |
+-----------+
(ii)
Output
+-------------------+------------+----------+
| ItemName | MAX(Price) | Count(*) |
+-------------------+------------+----------+
| LAPTOP | 57000 | 2 |
| PERSONAL COMPUTER | 37000 | 3 |
+-------------------+------------+----------+
(iii)
Output
+--------------+--------------+
| CustomerName | Manufacturer |
+--------------+--------------+
| N ROY | PQR |
| H SINGH | XYZ |
| R PANDEY | COMP |
| C SHARMA | PQR |
| K AGARWAL | ABC |
+--------------+--------------+
(iv)
Output
+-------------------+-------------+
| ItemName | Price * 100 |
+-------------------+-------------+
| LAPTOP | 5500000 |
| PERSONAL COMPUTER | 3500000 |
+-------------------+-------------+
Answered By
3 Likes