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

SQL Test

Emp set perks=23000 where emp_id=102; 5)select emp_name from emp where extract(year from join_date)=1989; EMP_NAME Sheela concept alter table emp add desig char(4); update emp set desig='FCTY'; / / select emp_name,round(months_between(sysdate,join_date)as months from emp ord er by months desc; months 199

Uploaded by

Ashwin Raju
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views

SQL Test

Emp set perks=23000 where emp_id=102; 5)select emp_name from emp where extract(year from join_date)=1989; EMP_NAME Sheela concept alter table emp add desig char(4); update emp set desig='FCTY'; / / select emp_name,round(months_between(sysdate,join_date)as months from emp ord er by months desc; months 199

Uploaded by

Ashwin Raju
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

1)select emp_name as employee from emp where salary>20000 ;

EMPLOYEE
Rajesh
Ashwin
Kiran
Sheela

2)select e.emp_name from emp e,dept d where (e.dept_id=d.dept_id)AND(d.dept_name


not in('Coding','BI'));
EMP_NAME
Kiran
Sheela
3)select emp_id,emp_name from emp order by(emp_name)asc;
EMP_ID EMP_NAME
102 Ashwin
104 Indraroop
103 Kiran
101 Rajesh
105 Sheela
4)select emp_name from emp where emp_name like '%S%';
EMP_NAME
Sheela

concept:
update emp
set perks=23000 where emp_id=102;

5)select emp_name from emp where extract(year from join_date)=1989;


EMP_NAME
Rajesh
Ashwin
concept
alter table emp
add desig char(4);
update emp
set desig='FCTY' where emp_id IN(104,105);

//select emp_name,desig as training from emp where salary>20000;//

6)select emp_name,round(months_between(sysdate,join_date))as months from emp ord


er by months desc;
EMP_NAME MONTHS
Sheela 315
Indraroop 199
MaheSh 176
Kiran 161
Ashwin 154
Rajesh 148
//select emp_name,salary, to_char(join_date,'ddth month, yyyy')from emp;
EMP_NAME SALARY TO_CHAR(JOIN_DATE,'DDTHMONTH,YYYY')
Rajesh 22000 09th september, 1989
Ashwin 21000 23rd february , 1989
Kiran 21500 12th august , 1988
Indraroop 18500 05th june , 1985
Sheela 33500 08th october , 1975
MaheSh 25000 06th may , 1987 //

7)select emp_name,salary, to_char(join_date,'ddth month, yyyy')from emp where sa


lary>(1.5*perks);

EMP_NAME SALARY TO_CHAR(JOIN_DATE,'DDTHMONTH,YYYY')


Rajesh 22000 09th september, 1989
Ashwin 21000 23rd february , 1989
Kiran 21500 12th august , 1988
Indraroop 18500 05th june , 1985
Sheela 33500 08th october , 1975
MaheSh 25000 06th may , 1987

8)select to_char (join_date,'month dd yy') from emp;

TO_CHAR(JOIN_DATE,'MONTH DD YY')
september 09 89
february 23 89
august 12 88
june 05 85
october 08 75
may 06 87
9)select upper(substr(dept_name,1,5)) || ' Managed by ' || dept_manager from d
ept;
UPPER(SUBSTR(DEPT_NAME,1,5))||'MANAGEDBY'||DEPT_MANAGER
CODIN Managed by Sunil
TESTI Managed by Ansar
BI Managed by Fatass
UNIX Managed by Senthil
10)select min(salary),max(salary)from emp;
MIN(SALARY) MAX(SALARY)
18500 33500

create table EMPTEST as


select * from emp;

alter table emp


modify emp_name varchar(40);

You might also like