Skip to content
Question
Q.

(a) Consider the following tables :

Table 1 : TEACHER, which stores Teacher ID (TID), Teacher Name (TName), Experience (Experience) and City (City) that they live in.

TIDTNameExperienceCity
1Kartik5Bhopal
2Shahnaz6Nagpur
3Rajendra7Delhi
4Tanvi4Bhopal
5Alam9Delhi

Table 2 : SUBJECT, which stores Subject ID (SID), Subject Name (SubName) and ID of the teacher(TID) teaching that Subject.

SIDSubNameTID
101Physics1
102Chemistry2
103Mathematics3
104Informatics Practices4
105Computer Science5

Write appropriate SQL query for the following : (I) Delete the record of the subject whose TID is equal to 4. (II) Display the names of teachers who have more than 5 years of experience and who stay in Nagpur. (III) Display subject names along with their teacher names.

OR

(b) Consider the table LIBRARY as given below.

BookIdTitleGenrePrice
101Python BasicsTechnology278
201The Silent PatientFiction340
301Data ScienceTechnology291
401OceansMarine LifeNULL

(I) Which attribute(s) can be considered as the Candidate keys(s) ? Justify your answer. (II) Write an SQL query to insert a new record with the following values : BookId : 501 Title : AI for ALL Genre : Technology Price : 589 (III) Write an SQL query to add a new column Author that is a character data type of size 20.

CBSECBSE Class XII Board 2026Subjective· 3mImportance★★★★★
🔒 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): (I) DELETE FROM SUBJECT WHERE TID = 4; (II) SELECT TName ... WHERE Experience > 5 AND City = 'Nagpur'; (III) join SUBJECT and TEACHER on TID.

Part (b): (I) BookId (and Title on this data) are candidate keys, BookId chosen; (II) INSERT a new row; (III) ALTER TABLE ... ADD Author VARCHAR(20).

Part (a)

(I) Delete the subject whose TID = 4. DELETE with a WHERE clause targets only the matching row (Informatics Practices, SID 104):

DELETE FROM SUBJECT WHERE TID = 4;

(II) Teachers with experience above 5 years living in Nagpur. Both conditions must hold, so combine them with AND:

SELECT TName FROM TEACHER WHERE Experience > 5 AND City = 'Nagpur';

(This returns Shahnaz — experience 6, Nagpur.)

(III) Subject names along with their teacher names. The link between the tables is TID, so an inner JOIN matches each subject to its teacher:

SELECT S.SubName, T.TName
FROM SUBJECT S JOIN TEACHER T ON S.TID = T.TID; …

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.