0% found this document useful (0 votes)
10 views1 page

Lab Session 4

The document discusses using DDL commands like alter and drop to modify tables by adding and removing columns, including adding a college name column to a student table and adding a salary column to an emp table.

Uploaded by

VAIBHAV KUSHWAHA
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views1 page

Lab Session 4

The document discusses using DDL commands like alter and drop to modify tables by adding and removing columns, including adding a college name column to a student table and adding a salary column to an emp table.

Uploaded by

VAIBHAV KUSHWAHA
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Lab Session – 04

OBJECT- To use DDL (alter and drop) command-

1. To alter student table and add a new column college_name.


2. To alter student table and drop a column branch.
3. To alter emp table and add a new column salary.
4. To alter emp table and drop a column age.

Syntax-
mysql> alter table table_name ADD column_name datatype(size);
mysql> alter table table_name drop column_name datatype(size);

Query-
1. To alter student table and add a new column college_name.
mysql> alter table student ADD college_name varchar(20);

2. To alter student table and drop a column branch.


mysql> alter table student drop column branch;

3. To alter emp table and add new column salary.


mysql> alter table emp ADD salary int;

4. To alter emp table and drop a column age.


mysql> alter table emp drop column age;

Output-
Output in fig 4.1

You might also like