Data Manipulation Language (DML)

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 2

DATA MANIPULATION LANGUAGE (DML)

mysql> create table employee(ename char(15), eid varchar(10),doj date, basicpay decimal(8,2), age int,
address varchar(25));

Query OK, 0 rows affected (0.24 sec)

mysql> insert into employee values('anu','e101','2010-10-12',40000,35,'chennai');


Query OK, 1 row affected (0.05 sec)

mysql> insert into employee values('vishnu','e102','2011-10-12',38000,34,'pune'),


('gokul','e103','2012-09-12',35000,33,'mumbai'), ('akash’,'e104','2011-09-12',45
000,33,'goa'),('priya','e105','2010-09-03',50000,29,'delhi');

Query OK, 4 rows affected (0.03 sec)


Records: 4 Duplicates: 0 Warnings: 0

mysql> select * from employee;

+--------+ ------ +------------+---------- +------ +---------+


| ENAME | EID | DOJ | BASICPAY| AGE | ADDRESS|
+--------+ ------ +------------+---------- +------ +---------+
| ANU | E101 | 2010-10-12 | 40000.00 | 35 | CHENNAI |
| VISHNU | E102 | 2011-10-12 | 38000.00 | 34 | PUNE |
| GOKUL | E103 | 2012-09-12 | 35000.00 | 33 | MUMBAI |
| AKASH | E104 | 2011-09-12 | 45000.00 | 33 | GOA |
| PRIYA | E105 | 2010-09-03 | 50000.00 | 29 | DELHI |
+--------+------+------------+----------+------+---------+
5 rows in set (0.02 sec)

mysql>update employee set basicpay=basicpay+(basicpay*0.1);


Query OK, 5 rows affected (0.04 sec)
Rows matched: 5 Changed: 5 Warnings: 0

mysql> select * from employee;

+-------- +------ +------------ +---------- +------ +---------+


| ENAME | EID | DOJ | BASICPAY | AGE | ADDRESS |
+-------- +------ +------------ +---------- +------ +---------+
| ANU | E101 | 2010-10-12 | 44000.00 | 35 | CHENNAI |
| VISHNU | E102 | 2011-10-12 | 41800.00 | 34 | PUNE |
| GOKUL | E103 | 2012-09-12 | 38500.00 | 33 | MUMBAI |
| AKASH | E104 | 2011-09-12 | 49500.00 | 33 | GOA |
| PRIYA | E105 | 2010-09-03 | 55000.00 | 29 | DELHI |
+--------+------+------------+----------+------+---------+
5 rows in set (0.01 sec)

mysql> delete from employee where eid="E103";


Query OK, 1 row affected (0.04 sec)

mysql> select * from employee;

+-------- +------ +------------ +---------- +------ +---------+


| ENAME | EID | DOJ | BASICPAY | AGE | ADDRESS |
+-------- +------ +------------ +---------- +------ +---------+
| ANU | E101 | 2010-10-12 | 44000.00 | 35 | CHENNAI |
| VISHNU | E102 | 2011-10-12 | 41800.00 | 34 | PUNE |
| AKASH | E104 | 2011-09-12 | 49500.00 | 33 | GOA |
| PRIYA | E105 | 2010-09-03 | 55000.00 | 29 | DELHI |
+-------- +------ +------------ +---------- +------ +---------+
4 rows in set (0.00 sec)

mysql>

You might also like