Skip to content
Question

Q.(A) Ms. Veda created a table named Sports in a MySQL database, containing columns Game_id, P_Age and G_name. After creating the table, she realized that the attribute, Category has to be added. Help her to write a command to add the Category column. Thereafter, write the command to insert the following record in the table: Game_id: G42 P_Age: Above 18 G_name: Chess Category: Senior

(OR)
(B) Write the SQL commands to perform the following tasks:
(i) View the list of tables in the database, Exam.
(ii) View the structure of the table, Term1.
CBSECBSE Class XII Board 2024Subjective· 2mImportance★★★★★
🔒 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): ALTER TABLE Sports ADD Category VARCHAR(20); to add the column, then INSERT INTO Sports VALUES(...) to add the row. Part (b): SHOW TABLES FROM Exam; lists tables and DESCRIBE Term1; shows a table's structure.

Part (a)

To add a new attribute to an existing table you modify its structure with ALTER TABLE ... ADD, giving the new column a name and a data type. Since Category stores text like 'Senior', a VARCHAR is appropriate.

ALTER TABLE Sports ADD Category VARCHAR(20);

Now the table has four columns: Game_id, P_Age, G_name, Category. Insert the record with INSERT INTO; string values go in single quotes. Naming the columns is good practice but optional if you supply values in table order.

INSERT INTO Sports (Game_id, P_Age, G_name, Category)
VALUES ('G42', 'Above 18', 'Chess', 'Senior');
``` …

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.