Q.(i) A SQL table ITEMS contains the following columns: INO, INAME, QUANTITY, PRICE, DISCOUNT Write the SQL command to remove the column DISCOUNT from the table.
You're viewing a preview — the full solution, concept, methods & PYQ mapping are locked.
Start your 14-day free trial to unlock the full solution →To remove a column from a table in SQL, you use the ALTER TABLE command with the DROP COLUMN clause. The commands CREATE and DROP belong to DDL (Data Definition Language), while UPDATE and INSERT belong to DML (Data Manipulation Language).
(i) Removing the DISCOUNT column
The SQL command to remove the column DISCOUNT from the table ITEMS is:
ALTER TABLE ITEMS DROP COLUMN DISCOUNT;
Let’s understand why this is the correct command. In SQL, the structure of a table — its columns, their data types, and constraints — is defined using Data Definition Language (DDL). To change that structure after the table has been created, you use the ALTER TABLE statement. The specific clause for removing a column is DROP COLUMN, followed by the column’s name.
Some database systems (like MySQL) allow the shorter form ALTER TABLE ITEMS DROP DISCOUNT (without the word COLUMN), but the standard SQL syntax includes COLUMN. The NCERT textbook follows the standard SQL syntax, so DROP COLUMN is the correct form to use in an exam.
A common mistake is to think you can use DELETE or UPDATE to remove a column — those commands work on rows of data, not on the table’s structure. DELETE removes records; ALTER TABLE ... DROP COLUMN removes the column definition itself, along with all its data.
Once a column is dropped, all data stored in that column is permanently lost. There is no undo. Always double-check before executing this command on a real database.
(ii) Categorizing SQL commands into DDL and DML
SQL commands are broadly divided into two categories based on what they do:
- DDL (Data Definition Language): These commands define, modify, or remove the structure of database objects (tables, indexes, views, etc.). They work on the schema — the blueprint of the database.
- DML (Data Manipulation Language): These commands work on the data inside the tables — inserting, updating, deleting, or retrieving records.
Now let’s place each command: …
Unlock everything free for 14 days
- Full step-by-step solutions
- Concept-first explanations
- Methods, shortcuts & mistakes
- PYQ mapping + timed mock tests
Full access for 14 days. No credit card required.