© examsnet.com
Question : 10 of 13
Marks: +1, -0
The school has asked their estate manager Mr. Rahul to maintain the data of all the labs in a table LAB. Rahul has created a table and entered data of 5 labs.
LABNOLAB_NAMEINCHARGECAPACITYFLOOR
L001CHEMISTRYDaisy20I
L002BIOLOGYVenky20II
L003MATHPreeti15I
L004LANGUAGEDaisy36III
L005COMPUTERMary Kom37II
Based on the data given above answer the following questions :
(i) Identify the columns which can be considered as Candidate keys. [1]
(ii) Write the degree and cardinality of the table. [1]
(iii) Write the statements to : [2]
(a) Insert a new row with appropriate data.
(b) Increase the capacity of all the labs by 10 students which are on ‘I’ Floor.
OR
(Option for part (iii) only)
(iii) Write the statements to : [2]
(a) Add a constraint PRIMARY KEY to the column LABNO in the table.
(b) Delete the table LAB.
[CBSE 2023 Set 4]
Solution:  
(i) LABNO and LAB_NAME: each has a different value in every row, so each can identify a lab uniquely. (INCHARGE repeats Daisy, CAPACITY repeats 20 and FLOOR repeats I and II.)
(ii) Degree = number of columns = 5; Cardinality = number of rows = 5.
(iii)
(a) INSERT INTO LAB VALUES ('L006', 'PHYSICS', 'Ravi', 25, 'II');
(b) UPDATE LAB SET CAPACITY = CAPACITY + 10 WHERE FLOOR = 'I';
OR (iii)
(a) ALTER TABLE LAB ADD PRIMARY KEY (LABNO);
(b) DROP TABLE LAB;
DROP TABLE removes the table with its structure and data (DELETE FROM LAB would remove only the rows).
© examsnet.com
Advertisements
Go to Question: