You are on page 1of 6

PG:

ASSIGNMENT Day 8:

83. Create a table EMPLOYEE with following schema:


(Emp_no, E_name, E_address, E_ph_no),( Dept_no, Dept_name,Job_id, Designation
, Salary)
Write SQL statements for the following query.

1.List the E_no, E_name, Salary of all employees working for MANAGER.
 SQL> Select * from employee
 2 where designation <> 'manager' and designation <> 'president';


2. Display all the details of the employee whose salary is more than the Sal of any IT
PROFF..
 SQL> select * from employee
 2 where salary >( select min(salary) from employee where dept_name = 'it');

NAME:
This study source SECTION:
was downloaded by 100000842641439 from CourseHero.com on 02-28-2022 01:08:45 GMT -06:00 ROLL:

https://www.coursehero.com/file/34862833/ASSIGNMENT-Day-8pdf/
PG:


3.List the employees in the ascending order of Designations of those joined after
1981.
 SQL> select e_name as name, designation from employee
 2 where dateofjoining > to_date('30-12-1981', 'DD-MM-YYYY') order by
designation desc;


4.List the employees along with their Experience and Daily Salary.
 SQL> (select e_name, months_between(sysdate,dateofjoining)/3 as experience,
salary/30 as daily_salary from employee);


5.List the employees who are either „CLERK‟ or „ANALYST‟.
 SQL> select * from employee where designation = 'clerk' or designation
='analyst';

NAME:
This study source SECTION:
was downloaded by 100000842641439 from CourseHero.com on 02-28-2022 01:08:45 GMT -06:00 ROLL:

https://www.coursehero.com/file/34862833/ASSIGNMENT-Day-8pdf/
PG:


6.List the employees who joined on 1-MAY-81, 3-DEC-81, 17-DEC-81,19-JAN-80 .
 SQL> select emp_no, e_name, dateofjoining from employee where
dateofjoining = to_date('01-05-1981', 'DD-MM-YYYY') or dateofjoining =
to_date('03-12-1981', 'DD-MM-YYYY') or dateofjoining = to_date('17-12-
1981', 'DD-MM-YYYY') or dateofjoining = to_date('19-01-1980', 'DD-MM-
YYYY');


7.List the employees who are working for the Deptno 10 or20.
 SQL> select emp_no, e_name, dept_no from employee
 2 where dept_no = 10 or dept_no = 20;


8.List the Enames those are starting with „S‟.
 SQL> select e_name from employee where e_name like 's%';


9.Dislay the name as well as the first five characters of name(s) starting with „H‟
 SQL> select substr(e_name,1,5) from employee where e_name like 'h%';


10.List all the emps except „PRESIDENT‟ & „MGR” in asc order of Salaries.

NAME:
This study source SECTION:
was downloaded by 100000842641439 from CourseHero.com on 02-28-2022 01:08:45 GMT -06:00 ROLL:

https://www.coursehero.com/file/34862833/ASSIGNMENT-Day-8pdf/
PG:

 SQL> Select * from employee


 2 where designation <> 'manager' and designation <> 'president'
 3 order by salary asc;

84. Write an example of the following functions :

Sqrt()
SQL> select sqrt(16) from dual;

Power()
SQL> select power(16,2) from dual;

Ceil()
SQL> select ceil(1.555462) from dual;

Substr()
SQL> select substr('ahsvjbcwjbc', 3, 6) from dual;

Max()
SQL> select max(salary) from employee;

NAME:
This study source SECTION:
was downloaded by 100000842641439 from CourseHero.com on 02-28-2022 01:08:45 GMT -06:00 ROLL:

https://www.coursehero.com/file/34862833/ASSIGNMENT-Day-8pdf/
PG:

min()
SQL> select min(salary) from employee;

Round()
SQL> select round(1.555462) from dual;

to_date()
SQL> select to_date('11-12-1981', 'dd-mm-yyyy') from dual;

to_char()
SQL> select to_char(sysdate, 'dd-mm-yyyy') from dual;

Length()
SQL> select length('dd-mm-yyyy') from dual;

avg()
SQL> select avg(salary) from employee;

count()
SQL> select count(emp_no) from employee;

Exp()
SQL> select exp(1.555462) from dual;

mod()
SQL> select mod(12,5) from dual;

lower()
SQL> select lower('ABCDEFG') from dual;

NAME:
This study source SECTION:
was downloaded by 100000842641439 from CourseHero.com on 02-28-2022 01:08:45 GMT -06:00 ROLL:

https://www.coursehero.com/file/34862833/ASSIGNMENT-Day-8pdf/
PG:

Initcap()
SQL> select initcap('abcdefg') from dual;

instr()
SQL> select instr('abcdefg', 'e') from dual;

months_between()
SQL> select months_between(to_date('29-11-2018','DD-MM-YYYY'), sysdate) from dual;

NAME:
This study source SECTION:
was downloaded by 100000842641439 from CourseHero.com on 02-28-2022 01:08:45 GMT -06:00 ROLL:

https://www.coursehero.com/file/34862833/ASSIGNMENT-Day-8pdf/
Powered by TCPDF (www.tcpdf.org)

You might also like