DBMS3
DBMS3
Experiment 3
No:
Experiment To study and implement Alter and Update commands
Title
Resources / Hardware: Software: Draw io
Apparatus PC
Required
Theory ALTER Command:
The ALTER command in SQL is used to modify an existing database object, such
as a table. It can be used to add, modify, or delete columns and constraints.
Syntax-
1. Add a Column
ALTER TABLE table_name
ADD column_name data_type [constraint];
2. Modify a Column
ALTER TABLE table_name
MODIFY column_name new_data_type [constraint];
3. Drop a Column
ALTER TABLE table_name
DROP COLUMN column_name;
Syntax:
UPDATE table_name
SET column1 = value1, column2 = value2, ...
WHERE condition;
Here,
table_name: The name of the table where you want to update records.
SET: Specifies the columns to be updated and their new values.
WHERE: Specifies which records should be updated. If omitted, all records in
the table will be updated.
Output:
Output:
Output:
Output: