Worked Examples · Example 13
Q.Write SQL statements to
(i) change the marks of the student with RollNo 1 to 80, and
(ii) delete the record of the student with RollNo 2 from the Student table.
ChseodishaTextbookSubjectiveImportance★★★★★est
87% · 13/15 Questions
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 →Both of these are DML operations, and both need a WHERE clause so that they affect only the intended row.
(i) Changing data uses UPDATE ... SET ... WHERE. To set the marks of the student whose RollNo is 1 to 80:
UPDATE Student
SET Marks = 80
WHERE RollNo = 1;
The WHERE RollNo = 1 part is essential — without it, the marks of every student would be changed to 80.
(ii) Removing data uses DELETE FROM ... WHERE. To delete the record of the student whose RollNo is 2:
DELETE FROM Student
WHERE RollNo = 2;
``` …
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.