Which of the following will be the correct SQL command to add a new column…
2023
Which of the following will be the correct SQL command to add a new column FEES in a table TEACHER?
- A.
ALTER TABLE TEACHER ADD COLUMN FEES FLOAT; / ALTER TABLE TEACHER ADD COLUMN FEES FLOAT;
- B.
ADD COLUMN FEES FLOAT INTO TEACHER; / ADD COLUMN FEES FLOAT INTO TEACHER;
- C.
UPDATE TEACHER ADD COLUMN FEES FLOAT; / UPDATE TEACHER ADD COLUMN FEES FLOAT;
- D.
INSERT INTO TEACHER ADD COLUMN FEES FLOAT; / INSERT INTO TEACHER ADD COLUMN FEES FLOAT;
Attempted by 1828 students.
Show answer & explanation
Correct answer: A
Correct command: ALTER TABLE TEACHER ADD COLUMN FEES FLOAT;
Why this works: ALTER TABLE modifies the table schema and ADD COLUMN introduces a new column named FEES with the FLOAT data type. Some SQL dialects allow using ADD instead of ADD COLUMN. End the statement with a semicolon where required.
Notes:
ALTER TABLE is used to change table structure (add, drop, or modify columns).
Specify the column name and its datatype (e.g., FEES FLOAT). You can also add constraints or a DEFAULT value if needed.
Why the other commands are incorrect:
ADD COLUMN FEES FLOAT INTO TEACHER; — Incorrect because INTO is not part of ALTER TABLE syntax; INTO is used with INSERT statements.
UPDATE TEACHER ADD COLUMN FEES FLOAT; — Incorrect because UPDATE changes row data, not the table schema. Use ALTER TABLE to change schema.
INSERT INTO TEACHER ADD COLUMN FEES FLOAT; — Incorrect because INSERT INTO inserts rows; it cannot alter the table structure.
A video solution is available for this question — log in and enroll to watch it.