Skip to content
Question 26 of 29

Q.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. LABNO LAB_NAME INCHARGE CAPACITY FLOOR L001 CHEMISTRY Daisy 20 I L002 BIOLOGY Venky 20 II L003 MATH Preeti 15 I L004 LANGUAGE Daisy 36 III L005 COMPUTER Mary Kom 37 II Based on the data given above answer the following questions:

(i) Identify the columns which can be considered as Candidate keys.
(ii) Write the degree and cardinality of the table.
(iii) Write the statements to:
(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:
(a) Add a constraint PRIMARY KEY to the column LABNO in the table.
(b) Delete the table LAB.
Sikkim CbseCBSE Class XII Board 2023Subjective· 4mImportance★★★★★
90% · 26/29 Questions
🔒 Locked · start free trial →

You're viewing a preview — the full solution, concept, methods & PYQ mapping are locked.

Start your 14-day free trial to unlock the full solution →

Part (a): candidate keys are LABNO and LAB_NAME; degree 5 and cardinality 5; INSERT a new lab and UPDATE capacities on floor 'I'.

Part (b): the (iii) alternative — ALTER TABLE to add PRIMARY KEY(LABNO), and DROP TABLE LAB.

Part (a)

(i) Candidate keys. A candidate key uniquely identifies each row and is minimal. Checking the five rows:

  • LABNO — L001, L002, L003, L004, L005 are all distinct -> candidate key.
  • LAB_NAME — CHEMISTRY, BIOLOGY, MATH, LANGUAGE, COMPUTER are all distinct -> candidate key.
  • INCHARGE — Daisy appears twice (L001, L004), not unique.
  • CAPACITY — 20 appears twice, not unique.
  • FLOOR — I and II repeat, not unique.

So the candidate keys are LABNO and LAB_NAME.

(ii) Degree and cardinality. Degree = number of columns = 5 (LABNO, LAB_NAME, INCHARGE, CAPACITY, FLOOR). Cardinality = number of rows = 5.

(iii) SQL statements.

-- (a) insert a new row with appropriate data
INSERT INTO LAB VALUES ('L006', 'PHYSICS', 'Ravi', 25, 'I');

-- (b) increase capacity of all labs on floor 'I' by 10
UPDATE LAB SET CAPACITY = CAPACITY + 10 WHERE FLOOR = 'I';
``` …

Unlock everything free for 14 days

  • Full step-by-step solutions
  • Concept-first explanations
  • Methods, shortcuts & mistakes
  • PYQ mapping + timed mock tests

Full access for 14 days. No credit card required.