11. Carefully observe the following table named ‘stock’:
Table: stock
| Pid |
PName |
Category |
Qty |
Price |
| 1 |
Keyboard |
IO |
15 |
450 |
| 2 |
Mouse |
IO |
10 |
350 |
| 3 |
Wifi-router |
NW |
5 |
2600 |
| 4 |
Switch |
NW |
3 |
3000 |
| 5 |
Monitor |
O |
10 |
4500 |
| 6 |
Printer |
O |
4 |
17000 |
Write SQL queries for the following:
(a) To display the records in decreasing order of price.
Ans: select * from stock order by price desc;
(b) To display category and category wise total quantities of products.
Ans: select category, sum(qty) from stock group by category;
(c) To display the category and its average price.
Ans: select category,avg(price) from stock group by category;
(d) To display category and category wise highest price of the products.
Ans: select category, max(price) from stock group by category;
12. Satyam, a database analyst has created the following table:
Table: Student
| RegNo |
SName |
Stream |
Optional |
Marks |
| S1001 |
Akshat |
Science |
CS |
99 |
| S1002 |
Harshit |
Commerce |
IP |
95 |
| S1003 |
Devika |
Humanities |
IP |
100 |
| S1004 |
Manreen |
Commerce |
IP |
98 |
| S1005 |
Gaurav |
Humanities |
IP |
82 |
| S1006 |
Saurav |
Science |
CS |
NULL |
| S1007 |
Bhaskar |
Science |
CS |
95 |
| S1007 |
Bhaskar |
Science |
CS |
96 |
He has written following queries:
Help him in predicting the output of the above given queries.
(a) select sum(MARKS) from student where OPTIONAL= ‘IP’ and STREAM= ‘Commerce’;
Ans: 193
(b) select max(MARKS)+min(MARKS) from student where OPTIONAL= ‘CS’;
Ans: 194
(c) select avg(MARKS) from student where OPTIONAL= ‘IP’;
Ans: 93.75
(d) select length(SNAME) from student where MARKS is NULL;
Ans: 6
OR
Based on the above given table named ‘Student’, Satyam has executed following queries:
• Select count(*) from student;
• Select count(MARKS) from student;
Predict the output of the above given queries.
Also give proper justifications of the output generated through each query.
Ans: First query will produce the output 7.
Justification: count (*) will count and display total number of rows (irrespective of any null value present in any of the column).
Second query will produce the output 6.
Justification: count (col_name) will count and display total number of not null values in the specified column.
13. “Anutulya Creations”-A start-up fashion house has set up its main centre at Kanpur, Uttar Pradesh for its dress designing, production and dress supplying activities. It has 4 blocks of buildings.
Distance between the various blocks is as follows:
A to D - 50 m
A to P - 60 m
A to S - 110 m
D to S - 60 m
P to S - 50 m
P to D - 150 m
Numbers of computers in each block
Block A - 20
Block D - 80
Block P - 15
Block S - 8
Based on the above specifications, answer the following questions:
(a) Out of LAN, WAN and MAN, what type of network will be formed if we interconnect different computers of the campus? Justify.
Ans: LAN - As computers are placed with-in the same campus within a small range.
(b) Suggest the topology which should be used to efficiently connect various blocks of buildings within Kanpur centre for fast communication.
Also draw the cable layout for the same.
Ans: Star Topology
(c) Suggest the placement of the following device with justification
i. Repeater - Repeater should be placed in between Block 'D' (Design) and Block 'P' as distance is more.
ii. Hub/Switch - Hub/Switch should be placed in each building to connect various computers together.
(d) Now a day, video-conferencing software is being used frequently by the company to discuss the product details with the clients. Name any one video conferencing software.
Also mention the protocol which is used internally in video conferencing software.