Q.Write SQL statements to insert the remaining 4 rows of table 8.7 in table STUDENT.
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 →The text has already inserted RollNumber 1 (Atharv Ahuja) and RollNumber 3 (Taleem Shah, whose GUID is NULL), so the remaining 4 rows of Table 8.7 are roll numbers 2, 4, 5 and 6.
One INSERT INTO STUDENT VALUES(...) each — dates in 'YYYY-MM-DD' single quotes, and every GUID must already exist in GUARDIAN (foreign-key rule).
Which rows are left?
| RollNumber | SName | SDateofBirth | GUID |
|---|---|---|---|
| 2 | Daizy Bhutia | 2002-02-28 | 111111111111 |
| 4 | John Dsouza | 2003-08-18 | 333333333333 |
| 5 | Ali Shah | 2003-07-05 | 101010101010 |
| 6 | Manika P. | 2002-03-10 | 466444444666 |
Foreign-key caution first: GUID in STUDENT references GUARDIAN. These four GUIDs must already be present in GUARDIAN (they are, after Activity 8.6) — otherwise MySQL rejects the insert. This is exactly why the chapter populates GUARDIAN before STUDENT.
The SQL statements
INSERT INTO STUDENT
VALUES(2, 'Daizy Bhutia', '2002-02-28',
111111111111);
INSERT INTO STUDENT
VALUES(4, 'John Dsouza', '2003-08-18',
333333333333);
INSERT INTO STUDENT
VALUES(5, 'Ali Shah', '2003-07-05',
101010101010);
INSERT INTO STUDENT
VALUES(6, 'Manika P.', '2002-03-10',
466444444666);
Query OK, 1 row affected (0.03 sec)
Query OK, 1 row affected (0.02 sec)
Query OK, 1 row affected (0.02 sec)
Query OK, 1 row affected (0.01 sec)
Key points: with no column list, the values must follow the table's attribute order RollNumber, SName, SDateofBirth, GUID and supply all four. Dates are stored in 'YYYY-MM-DD' format and, like all text/date values, are enclosed in single quotes. Names go in quotes too; numbers do not.
Verify
SELECT * FROM STUDENT;
| RollNumber | SName | SDateofBirth | GUID |
|---|---|---|---| …
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.