KnowledgeBoat Logo

Computer Science

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.

SQL Queries

4 Likes

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 ;

Answered By

1 Like


Related Questions