You are on page 1of 2

DATA DEFINITION LANGUAGE (DDL)

mysql>use vimali;

mysql> create table employ(ename varchar(15), eid varchar(5), doj date, basicpay decimal(9,2), age int);

Query OK, 0 rows affected (0.35 sec)

mysql> desc employ;

+----------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------+--------------+------+-----+---------+-------+
| ename | varchar(15) | YES | | NULL | |
| eid | varchar(10) | YES | | NULL | |
| doj | date | YES | | NULL | |
| basicpay | decimal(9,2) | YES | | NULL | |
| age | int(11) | YES | | NULL | |
+----------+--------------+------+-----+---------+-------+
5 rows in set (0.02 sec)

mysql> alter table employ add(address varchar(15));

Query OK, 0 rows affected (0.54 sec)


Records: 0 Duplicates: 0 Warnings: 0

mysql> desc employ


+----------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------+--------------+------+-----+---------+-------+
| ename | varchar(15) | YES | | NULL | |
| eid | varchar(10) | YES | | NULL | |
| doj | date | YES | | NULL | |
| basicpay | decimal(9,2) | YES | | NULL | |
| age | int(11) | YES | | NULL | |
| address | varchar(15) | YES | | NULL | |
+----------+--------------+------+-----+---------+-------+
6 rows in set (0.05 sec)

mysql> alter table employ modify address varchar(20);

Query OK, 0 rows affected (0.59 sec)


Records: 0 Duplicates: 0 Warnings: 0

mysql> desc employ;


+----------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------+--------------+------+-----+---------+-------+
| ename | varchar(15) | YES | | NULL | |
| eid | varchar(10) | YES | | NULL | |
| doj | date | YES | | NULL | |
| basicpay | decimal(9,2) | YES | | NULL | |
| age | int(11) | YES | | NULL | |
| address | varchar(20) | YES | | NULL | |
+----------+--------------+------+-----+---------+-------+
6 rows in set (0.02 sec)
mysql> drop table employ;

Query OK, 0 rows affected (0.17 sec)

mysql> desc employ;


ERROR 1146 (42S02): Table 'vimali.employ' doesn't exist

mysql>

You might also like