Write SQL statements to insert the remaining 3 rows of table 9.6 in table GUARDIAN.
| GUID | GName | GPhone | GAddress |
|---|---|---|---|
| 444444444444 | Amit Ahuja | 5711492685 | G-35, Ashok Vihar, Delhi |
| 111111111111 | Baichung Bhutia | 3612967082 | Flat no. 5, Darjeeling Appt., Shimla |
| 101010101010 | Himanshu Shah | 4726309212 | 26/77, West Patel Nagar, Ahmedabad |
| 333333333333 | Danny Dsouza | (no phone) | S-13, Ashok Village, Daman |
| 466444444666 | Sujata P. | 3801923168 | HNO-13, B-block, Preet Vihar, Madurai |
Table 9.6: GUARDIAN — the first record (Amit Ahuja) and the record without GPhone (Danny Dsouza) are already inserted in the chapter text; insert the remaining 3.
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 →Amit Ahuja's row and Danny Dsouza's (phone-less) row are inserted in the chapter text, so the three rows still to be added are Baichung Bhutia, Himanshu Shah and Sujata P. Each needs one INSERT INTO GUARDIAN (GUID, GName, GPhone, GAddress) VALUES (…); statement, with the string columns in single quotes and the 12-digit GUID as a numeric literal.
Which rows are still missing?
Table 9.6 has five guardians. The chapter already inserts two of them.
| GUID | GName | GPhone | GAddress | Already inserted? |
|---|---|---|---|---|
| 444444444444 | Amit Ahuja | 5711492685 | G-35, Ashok Vihar, Delhi | Yes — in the chapter |
| 111111111111 | Baichung Bhutia | 3612967082 | Flat no. 5, Darjeeling Appt., Shimla | No |
| 101010101010 | Himanshu Shah | 4726309212 | 26/77, West Patel Nagar, Ahmedabad | No |
| 333333333333 | Danny Dsouza | (no phone) | S-13, Ashok Village, Daman | Yes — in the chapter (the NULL-phone example) |
| 466444444666 | Sujata P. | 3801923168 | HNO-13, B-block, Preet Vihar, Madurai | No |
So exactly three INSERT statements are required.
The GUID column holds Aadhaar-style 12-digit identifiers. All three values needed here are printed in full in Table 9.6 and are used below — including Sujata P.'s, 466444444666.
The table
CREATE TABLE GUARDIAN (
GUID BIGINT PRIMARY KEY, -- 12 digits: too large for INT
GName VARCHAR(30),
GPhone CHAR(10),
GAddress VARCHAR(60)
);
A phone number is stored as CHAR(10), not as a number. Phone numbers are never used in arithmetic, and a numeric type would silently strip a leading zero.
The three INSERT statements
INSERT INTO GUARDIAN (GUID, GName, GPhone, GAddress)
VALUES (111111111111, 'Baichung Bhutia', '3612967082',
'Flat no. 5, Darjeeling Appt., Shimla');
INSERT INTO GUARDIAN (GUID, GName, GPhone, GAddress)
VALUES (101010101010, 'Himanshu Shah', '4726309212',
'26/77, West Patel Nagar, Ahmedabad');
INSERT INTO GUARDIAN (GUID, GName, GPhone, GAddress)
VALUES (466444444666, 'Sujata P.', '3801923168',
'HNO-13, B-block, Preet Vihar, Madurai');
MySQL replies to each statement with:
Query OK, 1 row affected (0.01 sec)
MySQL also allows all three rows in one statement, which is faster because the table is opened once:
INSERT INTO GUARDIAN (GUID, GName, GPhone, GAddress) VALUES
(111111111111, 'Baichung Bhutia', '3612967082', 'Flat no. 5, Darjeeling Appt., Shimla'),
(101010101010, 'Himanshu Shah', '4726309212', '26/77, West Patel Nagar, Ahmedabad'),
(466444444666, 'Sujata P.', '3801923168', 'HNO-13, B-block, Preet Vihar, Madurai');
Query OK, 3 rows affected (0.01 sec)
Records: 3 Duplicates: 0 Warnings: 0
Explaining the key parts
| Element | Why |
|---|---|
INSERT INTO GUARDIAN (col, col, …) | naming the columns makes the statement independent of the physical column order — the safe form |
'Baichung Bhutia' | strings and dates go in single quotes |
111111111111 | GUID is numeric — no quotes (if the column were CHAR(12), it would need quotes) |
| Address with a comma inside the quotes | commas inside a quoted string are ordinary characters, not value separators |
Verifying the result
SELECT * FROM GUARDIAN;
Output
| GUID | GName | GPhone | GAddress |
|---|---|---|---|
| 444444444444 | Amit Ahuja | 5711492685 | G-35, Ashok Vihar, Delhi |
| 333333333333 | Danny Dsouza | NULL | S-13, Ashok Village, Daman |
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.