English

Zack is working in a database named SPORT, in which he has created a table named “Sports” containing columns SportId, SportName, no_of_players,

Advertisements
Advertisements

Question

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.

Short/Brief Note
Advertisements

Solution

To delete the attribute, category:

ALTER TABLE Sports
DROP category;

To add the attribute, TypeSport

ALTER TABLE Sports
ADD TypeSport char(10) NOT NULL;
shaalaa.com
Data Types and Constraints in MySQL
  Is there an error in this question or solution?
2023-2024 (March) Board Sample Paper
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×