0% found this document useful (0 votes)
10 views5 pages

Database 6

Uploaded by

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

Database 6

Uploaded by

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

DATABASE PRACTICAL NO.

6 : Execute
SQL Queries using Arithmetic,
Comparison , Logical set, Between and
Like operators,

Practical related Questions and Exercise:


1)create table emp_6(empno 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.

insert into emp6 values(11,'jay',11,'cm',11,20000,'11-sep-2013'

1 row(s) inserted.
insert into emp6 values(12,'ajay',12,'ce',12,30000,'12-sep-2013')

1 row(s) inserted.
insert into emp6 values(13,'ahish',13,'me',13,40000,'13-sep-2013')

1 row(s) inserted.
insert into emp6 values(14,'vijay',14,'ej',14,50000,'14-sep-2013')

1 row(s) inserted.
insert into emp6 values(15,'ranvijay',15,'ee',15,60000,'15-sep-2013')

1 row(s) inserted.

a) select emp_name, (salary*.20) as incremented_salary from emp6

EMP_NAME INCREMENTED_SALARY

jay 4000

ajay 6000

ajay 6000
ahish 8000

vijay 10000

ranvijay 12000

CSV Export
b) select empno , emp_name from emp6 where salary<=50000 and salary>=25000

EMPNO EMP_NAME

13 ahish

14 vijay

12 ajay

3 rows returned in 0.00


seconds
CSV Exp

c) select*from emp6 where salary >(select salary from emp6 where emp_name='ahish')

EMPNO EMP_NAME DEPT_NO DEPT_NAME JOB_ID SALARY HIREDATE


15 ranvijay 15 ee 15 60000 15-SEP-13
14 vijay 14 ej 14 50000 14-SEP-13

CSV Export

d) select*from emp6 where dept_no<>201

EMPNO EMP_NAME DEPT_NO DEPT_NAME JOB_ID SALARY HIREDATE


11 jay 11 cm 11 20000 11-SEP-13
15 ranvijay 15 ee 15 60000 15-SEP-13
13 ahish 13 me 13 40000 13-SEP-13
14 vijay 14 ej 14 50000 14-SEP-13
12 ajay 12 ce 12 30000 12-SEP-13
5 rows returned in 0.01
CSV Export
seconds

2) create table emp6(empno 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.

insert into emp6 values(11,'jay',11,'cm',11,20000,'11-sep-2013')

1 row(s) inserted.
insert into emp6 values(12,'ajay',12,'ce',12,30000,'12-sep-2013')

1 row(s) inserted.
insert into emp6 values(13,'ahish',13,'me',13,40000,'13-sep-2013')

1 row(s) inserted.
insert into emp6 values(14,'vijay',14,'ej',14,50000,'14-sep-2013')

1 row(s) inserted.
insert into emp6 values(15,'ranvijay',15,'ee',15,60000,'15-sep-2013')

1 row(s) inserted.

a) select *from emp6

EMPNO EMP_NAME DEPT_NO DEPT_NAME JOB_ID SALARY HIREDATE


11 jay 11 cm 11 20000 11-SEP-13
12 ajay 12 ce 12 30000 12-SEP-13
13 ahish 13 me 13 40000 13-SEP-13
14 vijay 14 ej 14 50000 14-SEP-13
15 ranvijay 15 ee 15 60000 15-SEP-13
5 rows returned in 0.00
CSV Export
seconds

b) create table dept6(emp_name varchar(10),dept_no number(2), location varchar(10),job_id


number(2))

Table created.

insert into dept6 values('jay',11,'katraj',11)


1 row(s) inserted.
insert into dept6 values('ajay',12,'mcroad',12)
1 row(s) inserted.
insert into dept6 values('ahish',17,'kkmarket',17)
1 row(s) inserted.
insert into dept6 values('shreyas',18,'padmavati',18)
1 row(s) inserted.

insert into dept6 values('ranvijay',19,'ambegaon',19)


1 row(s) inserted.

c) select*from dept6
EMP_NAME DEPT_NO LOCATION JOB_ID
jay 11 katraj 11
ajay 12 mcroad 12
ahish 17 kkmarket 17
shreyas 18 padmavati 18
ranvijay 19 ambegaon 19
5 rows returned in 0.00 seconds CSV Export

d) select * from emp6 where salary between 10000 and 50000

EMPNO EMP_NAME DEPT_NO DEPT_NAME JOB_ID SALARY HIREDATE


11 jay 11 cm 11 20000 11-SEP-13
12 ajay 12 ce 12 30000 12-SEP-13
13 ahish 13 me 13 40000 13-SEP-13
14 vijay 14 ej 14 50000 14-SEP-13
4 rows returned in 0.00
CSV Export
seconds

e) select * from emp6 where emp_name in('shreyas')

EMPNO EMP_NAME DEPT_NO DEPT_NAME JOB_ID SALARY HIREDATE


15 shreyas 15 ee 15 60000 15-SEP-13
1 rows returned in 0.00
CSV Export
seconds

f) select * from emp61 where emp_name like 'a%'

EMPNO EMP_NAME DEPT_NO DEPT_NAME JOB_ID SALARY HIREDATE


12 ajay 12 ce 12 30000 12-SEP-13
13 ahish 13 me 13 40000 13-SEP-13
2 rows returned in 0.00
CSV Export
seconds

g) select * from emp61 where not(dept_name='cm')

EMPNO EMP_NAME DEPT_NO DEPT_NAME JOB_ID SALARY HIREDATE


12 ajay 12 ce 12 30000 12-SEP-13
13 ahish 13 me 13 40000 13-SEP-13
14 vijay 14 ej 14 50000 14-SEP-13
15 shreyas 15 ee 15 60000 15-SEP-13

4 rows returned in 0.02 seconds CSV Export

You might also like