✏️ Explanatory Question
CREATE TABLE Human( ID INT NOT NULL, FIRST_NAME VARCHAR (20) NOT NULL, LAST_NAME VARCHAR (20) NOT NULL, AGE INT NOT NULL, ADDRESS CHAR (25) , SALARY DECIMAL (18, 2) );
Question:
Which SQL statement is used to change the data type of the
FIRST_NAME column from VARCHAR(20) to
VARCHAR(50)?
Answer:
ALTER TABLE Human
MODIFY COLUMN FIRST_NAME VARCHAR(50) NOT NULL;
The MODIFY COLUMN clause is used in MySQL to change the definition
of an existing column. In this example, the size of the
FIRST_NAME column is changed from VARCHAR(20) to
VARCHAR(50). The NOT NULL constraint is retained.