CBSE Class 12 Computer Science Question 28 of 42

Solved 2024 Sample Question Paper CBSE Class 12 Computer Science (083) — Question 10

Back to all questions
10
Question

Question 24(b)

Zack is working in a database named SPORT, in which he has created a table named “Sports” containing columns SportId, SportName, no_of_players, and category. After creating the table, he realized that the attribute, category has to be deleted from the table and a new attribute TypeSport of data type string has to be added. This attribute TypeSport cannot be left blank. Help Zack write the commands to complete both the tasks.

Answer

SQL command to delete the attribute category from the table Sports:

ALTER TABLE Sports
DROP category ;

SQL command to add the attribute TypeSport to the table Sports:

ALTER TABLE Sports
ADD TypeSport char(10) NOT NULL ;