Alter and Modify
Alter and Modify
Syntax:
Parameters
table_name: It specifies the name of the table that you want to modify.
new_column_name: It specifies the name of the new column that you want to add
to the table.
column_definition: It specifies the data type and definition of the column (NULL or
NOT NULL, etc).
Example:
In this example, we add a new column "cus_age" in the existing table "cus_tbl".
Output:
See the recently added column:
Output:
Example:
In this example, we add two new columns "cus_address", and cus_salary in the
existing table "cus_tbl". cus_address is added after cus_surname column and
cus_salary is added after cus_age column.
Syntax:
Example:
Let's take an example to drop the column name "cus_address" from the table
"cus_tbl".
Use the following query to do this:
Output:
Example:
Output:
6) RENAME table
Syntax:
Output: