Skip to content
Activities · Activity 8.6

Q.Write SQL statements to insert the remaining 3 rows of table 8.6 in table GUARDIAN.

Punjab PsebTextbookSubjective· 3mImportance★★★★★est
27% · 12/45 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 →

The chapter has already inserted Amit Ahuja's row and Danny Dsouza's row (the one with no phone), so the remaining 3 rows of Table 8.6 are Baichung Bhutia, Himanshu Shah and Sujata P.

Each needs one INSERT INTO GUARDIAN VALUES(...) statement — all four values supplied, text in single quotes.

Which rows are left?

Table 8.6 has 5 records. The text has already inserted:

  • 444444444444, Amit Ahuja (full INSERT INTO ... VALUES form), and
  • 333333333333, Danny Dsouza (column-list form, because GPhone is missing → it stays NULL).

So the remaining 3 rows are:

GUIDGNameGPhoneGAddress
111111111111Baichung Bhutia3612967082Flat no. 5, Darjeeling Appt., Shimla
101010101010Himanshu Shah472630921226/77, West Patel Nagar, Ahmedabad
466444444666Sujata P.3801923168HNO-13, B- block, Preet Vihar, Madurai

The SQL statements

All four attribute values are known for each row, so the short form (no column list) works — values must follow the table's column order GUID, GName, GPhone, GAddress:

INSERT INTO GUARDIAN
VALUES (111111111111, 'Baichung Bhutia',
3612967082, 'Flat no. 5, Darjeeling Appt., Shimla');

INSERT INTO GUARDIAN
VALUES (101010101010, 'Himanshu Shah',
4726309212, '26/77, West Patel Nagar, Ahmedabad');

INSERT INTO GUARDIAN
VALUES (466444444666, 'Sujata P.',
3801923168, 'HNO-13, B- block, Preet Vihar, Madurai');
Query OK, 1 row affected (0.02 sec)
Query OK, 1 row affected (0.01 sec)
Query OK, 1 row affected (0.02 sec)

Key points: text values (names, addresses) must be enclosed in single quotes; the count and order of values must match the table's attributes exactly when no column list is given. One practical detail: GAddress was created as VARCHAR(30), but the chapter later widened it to VARCHAR(40) with ALTER TABLE GUARDIAN MODIFY GAddress VARCHAR(40); — these longer addresses (up to 39 characters) need that wider column, so run the ALTER first if you skipped it.

Verify

SELECT * FROM GUARDIAN;

| GUID | GName | GPhone | GAddress |

|---|---|---|---| …

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.