0% found this document useful (0 votes)
9 views

Database 5

Uploaded by

saee7390
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

Database 5

Uploaded by

saee7390
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

DATABASE PRACTICAL NO.

5 : Execute
DML Command in SQL
Practical related Questions:
1) create table empl(emp_no number(2), emp_name varchar(10), dept_no number(2), dept_name
varchar(10), job_id number(2), salary number(7),hiredate date)

Table created.

2) a) insert into empl values(11,'jay',11,'cm',11,10000,'12-aug-2012')

1 row(s) inserted.

b) insert into empl values(12,'ajay',12,'ce',12,20000,'11-aug-2012')

1 row(s) inserted.

c) insert into empl values(13,'vijay',13,'me',13,30000,'13-aug-2012')

1 row(s) inserted.

d) insert into empl values(14,'ranjay',14,'ej',14,40000,'14-aug-2012')

1 row(s) inserted.

e) insert into empl values(15,'digvijay',15,'ee',15,50000,'15-aug-2012')

1 row(s) inserted.

3) a) insert into empl values(1,'shreyas',10,'sales',11,40000,'28-aug-2014')

1 row(s) inserted.

b)delete empl where emp_name='shreyas'

1 row(s) deleted.

c)update empl set salary=50000 where dept_no=11

1 row(s) updated.

d)select*from empl where salary>=25000 and salary<=60000


EMP_NO EMP_NAME DEPT_NO DEPT_NAME JOB_ID SALARY HIREDATE
11 jay 11 Cm 11 50000 12-AUG-12
13 vijay 13 Me 13 30000 13-AUG-12
14 ranjay 14 Ej 14 40000 14-AUG-12
15 digvijay 15 Ee 15 50000 15-AUG-12

4 rows returned in 0.01 seconds CSV Export

Exerise:
1) create table emplo(emp_no number(2),emp_name varchar(20), dept_no
number(2), dept_name varchar(20), job_id number(2), salary number(7),
hiredate date)

Table created.

a)

insert into emplo values(21,'jay',21,'production',21,10000,'12-


aug-2012')
1 row(s) inserted.

insert into emplo values(22,'ajay',22,'sales',22,20000,'11-aug-


2012')
1 row(s) inserted.

insert into emplo


values(23,'vijay',23,'production',23,30000,'13aug-2012')
1 row(s) inserted.

insert into emplo values(24,'ranjay',24,'sales',24,40000,'14-aug-


2012')
1 row(s) inserted.

insert into emplo values(25,'digvijay',25,'sales',25,50000,'15-


aug-2012’)
1 row(s) inserted.

b) select* from employ

EMP_NO EMP_NAME DEPT_NO DEPT_NAME JOB_ID SALARY HIREDATE


21 jay 21 production 21 10000 12-AUG-12
24 ranjay 24 sales 24 30000 14-AUG-12
25 digvijay 25 sales 25 30000 15-AUG-12
23 vijay 23 production 23 30000 13-AUG-12
22 ajay 22 sales 22 30000 11-AUG-12
5 rows returned in 0.00
CSV Export
seconds
c) select* from emplo

EMP_NO EMP_NAME DEPT_NO DEPT_NAME JOB_ID SALARY HIREDATE


21 jay 21 production 21 10000 12-AUG-12
24 ranjay 24 sales 24 30000 14-AUG-12
25 digvijay 25 sales 25 30000 15-AUG-12
23 vijay 23 production 23 30000 13-AUG-12
22 ajay 22 sales 22 30000 11-AUG-12
5 rows returned in 0.00 CSV
seconds Export

d) select* from emplo where dept_name='production' and salary>5000

EMP_NO EMP_NAME DEPT_NO DEPT_NAME JOB_ID SALARY HIREDATE


21 jay 21 production 21 10000 12-AUG-12
23 vijay 23 production 23 30000 13-AUG-12
2 rows returned in 0.00 CSV
seconds Export

e) update emplo set salary=30000 where dept_name='sales'

3 row(s) updated.

f) delete from emplo where dept_name='sales' and salary>10000

3 row(s) deleted.

g) select* from emplo where dept_name='production'

EMP_NO EMP_NAME DEPT_NO DEPT_NAME JOB_ID SALARY HIREDATE


21 jay 21 production 21 10000 12-AUG-12
23 vijay 23 production 23 30000 13-AUG-12
2 rows returned in 0.01 CSV
seconds Export

You might also like