Tuesday, March 12, 2024

EMPLOYEE TABLE in ORACLE (RDBMS)

Q.EMPLOYEE TABLE


create table EMP(eid number, ename varchar2(20),age number,salary number,company varchar2(60));

insert into EMP values (1,'raju',30,30000,'TCS');

insert into EMP values (2,'indu',35,40000,'IBM');

insert into EMP values (3,'kalia',40,50000,'CTS');

select *

from EMP;

drop table EMP;


select * 

from EMP

where company='TCS';


select ename 

from EMP

where salary>=40000;


select ename 

from EMP

where age<=35 and salary>=40000;


select ename 

from EMP

where age<=35 or salary>=40000;


select min(salary)

from EMP;


select min(salary) as minimum_salary

from EMP;


select max(salary)

from EMP;


select max(salary) as maximum_salary

from EMP;


select avg(salary)

from EMP;


select avg(salary) as average_salary

from EMP;

++++++++++++++++++++++++++++++++++++++++++++++++++++++++

create table EMP(eid number, ename varchar2(20),age number,salary number,company varchar2(60));

insert into EMP values (1,'raju',30,30000,'TCS');

insert into EMP values (2,'indu',35,40000,'IBM');

insert into EMP values (3,'kalia',40,50000,'CTS');

select *

from EMP;

drop table EMP;


select * 

from EMP

where company='TCS';


select ename 

from EMP

where salary>=40000;


select ename 

from EMP

where age<=35 and salary>=40000;


select ename 

from EMP

where age<=35 or salary>=40000;


select min(salary)

from EMP;


select min(salary) as minimum_salary

from EMP;


select max(salary)

from EMP;


select max(salary) as maximum_salary

from EMP;


select avg(salary)

from EMP;


select avg(salary) as average_salary

from EMP;


select ename

from EMP

where salary=(select max(salary)

                from EMP);


select ename

from EMP

where salary=(select min(salary)

                from EMP);


select ename

from EMP

where salary>=(select avg(salary)

                from EMP);


select ename

from EMP

where age=(select max(age)

                from EMP);


select ename

from EMP

where salary>(select salary

                from EMP

                where ename='raju');

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

update EMP set company='TCS'

where eid=1;

select * from EMP;

update EMP set company='IBM'

where eid=2;

select * from EMP;

update EMP set company='CTS'

where eid=3;

select * from EMP;


update EMP set age=age+1;

select * from EMP;

No comments:

Post a Comment

A physicist confesses that the electron is round and that Jesus rose from the dead. (Bengali)

একজন পদার্থবিজ্ঞানী স্বীকার করেন যে ইলেকট্রন গোলাকার এবং যিশু মৃতদের মধ্য থেকে পুনরুত্থিত হয়েছিলেন। আমার নিজের বিশ্বাস প্রমাণ দ্বারা প্রভাব...