1. The document is a work report submitted by Apurv Gupta, a 3rd year BCA student, as a partial fulfillment for his degree.
2. It includes assessments performed on Oracle 10g relating to creating tables, inserting data, querying data using select statements, joining tables, and using nested and correlated subqueries.
3. The assessments cover creating employee, department, and salary grade tables; performing select queries to retrieve data from the tables including filtering, sorting, aggregation; and joining the tables to reduce data redundancy.
Solved in excel every step. Result is exactly as the screenshot in instruction sheet. You need to insert documentation worksheet from your excel which contains your name.
Solved in excel every step. Result is exactly as the screenshot in instruction sheet. You need to insert documentation worksheet from your excel which contains your name.
Here i am giving some sql queries which is helpful for practicing in sql server for learning more sql interview questions you can refer this link http://skillgun.com/sql/interview-questions-and-answers
MSCD650 Final Exam feedback FormMSCD650 Final Exam Grading For.docxgilpinleeanna
MSCD650 Final Exam feedback Form
MSCD650 Final Exam Grading Form
(Instructions follow the form)
Coding
55 Percent
Points Earned
Comments:
Trigger Code:
· Code meets requirements
· Code compiles cleanly
/15
Pre-Calculation Procedure Code
· Code meets requirements
· Code compiles cleanly
/15
PL/SQL Block Code
· Code meets requirements
· Code compiles cleanly
/15
Function Code
· Code meets requirements
· Code compiles cleanly
/10
/55
Unit Testing
35 Percent
Points Earned
Comments:
Unit Test for Trigger Code:
· All conditions are thoroughly tested
· The code runs successfully
· All data to prove test worked is displayed
/10
Unit Test for Procedure Code:
· All conditions are thoroughly tested
· The code runs successfully
· All data to prove test worked is displayed
· The tester can easily follow the path of the execution.
/10
.
Unit Test for PL/SQL Block Code:
· All conditions are thoroughly tested
· The code runs successfully
· All data to prove test worked is displayed
· The tester can easily follow the path of the execution.
/10
Unit Test for View/Function Code:
· All conditions are thoroughly tested
· The code runs successfully
· All data to prove test worked is displayed
· The tester can easily follow the path of the execution.
/5
/35
Documentation
10 Percent
Points Earned
Comments:
Presentation:
· The document is easy to read.
· The document is Professional in appearance
· It is easy for the reader to find what they are looking for.
/5
Documentation:
· Code is documented so that anyone who picks it up knows what it is doing.
/5
/10
Total 100
Percent
Points Earned
Comments:
Case Study
Overview of assignment
As a new ABC Consultant assigned to the XYZ Company, you have been asked to enhance the current system to include payroll processing. Although the current employee table has monthly salary and commission columns, it does not provide any means for storing employee deductions. You will add the tables necessary to store employee deductions. Next you will create a payroll pre-calculation program that will calculate the net pay for all the employees via a batch process (a stored procedure in a package, which will call other stored procedures within the package). Although this is not a complete payroll system, the unit test results must be accurate.
Next you will create two PL/SQL blocks for inserting and deleting rows from the employee deduction table. These PL/SQL blocks will be passed information from host or bind variables and a third PL/SQL block which will assign the variables defined in SQL*Plus (e.g. employee number, dollar amount and deduction name). Since the XYZ Company wants to track changes to the employee and employee deduction tables, you will create two database triggers that will update audit tables when rows are changed or deleted.
The XYZ Company also requires a view that will display specific employee information, plus the number of deductions for an employe ...
Gracika Benjamin , Diploma Fashion Design Second Yeardezyneecole
Portfolio Of Student Of Dezyne E'cole College,Gracika Benjamin , Second Year Fashion Design.This Is The Portfolio Of Her Work From Second Year .For More Details Visit www.dezyneecole.com
Sheikh Anjum Firdoush , Diploma Fashion Design Second Yeardezyneecole
Portfolio Of Student Of Dezyne E'cole College,Sheikh Anjum Firdoush , Second Year Fashion Design.This Is The Portfolio Of Her Work From Second Year .For More Details Visit www.dezyneecole.com
Harsha Chhaparwal, Diploma Fashion Design Second Yeardezyneecole
Portfolio Of Student Of Dezyne E'cole College,Harsha Chhaparwal , Second Year Fashion Design.This Is The Portfolio Of Her Work From Second Year .For More Details Visit www.dezyneecole.com
Harsha Chhaparwal, Diploma Fashion Design Second Yeardezyneecole
Portfolio Of Student Of Dezyne E'cole College,Harsha Chhaparwal , Second Year Fashion Design.This Is The Portfolio Of Her Work From Second Year .For More Details Visit www.dezyneecole.com
Harsha Chhaparwal, Diploma Fashion Design Second Yeardezyneecole
Portfolio Of Student Of Dezyne E'cole College,Harsha Chhaparwal , Second Year Fashion Design.This Is The Portfolio Of Her Work From Second Year .For More Details Visit www.dezyneecole.com
Sheikh Anjum Firdoush , Diploma Fashion Design Second Yeardezyneecole
Portfolio Of Student Of Dezyne E'cole College,Sheikh Anjum Firdoush , Second Year Fashion Design.This Is The Portfolio Of Her Work From Second Year .For More Details Visit www.dezyneecole.com
Sushmita Bhati, Diploma Fashion Design Second Yeardezyneecole
Portfolio Of Student Of Dezyne E'cole College, Sushmita Bhati, Second Year Fashion Design. This Is The Portfolio Of Her Work From Second Year .For More Details Visit www.dezyneecole.com
Sushmita Bhati, Diploma Fashion Design Second Yeardezyneecole
Portfolio Of Student Of Dezyne E'cole College, Sushmita Bhati, Second Year Fashion Design. This Is The Portfolio Of Her Work From Second Year .For More Details Visit www.dezyneecole.com
Sushmita Bhati, Diploma Fashion Design Second Year, (How to Design for Fashio...dezyneecole
Portfolio Of Student Of Dezyne E'cole College, Sushmita Bhati, Second Year Fashion Design. This Is The Portfolio Of Her Work From Second Year .For More Details Visit www.dezyneecole.com
Somya Jain, Diploma Fashion Design Second Year, (How to Design for Fashion In...dezyneecole
Portfolio Of Student Of Dezyne E'cole College, Somya Jain, Second Year Fashion Design. This Is The Portfolio Of Her Work From Second Year .For More Details Visit www.dezyneecole.com
Portfolio Of Student Of Dezyne E'cole College , Anurag Yadav , B.Voc-Interior Design First Year .This Is The Portfolio Of His Work From First Year .For More Details Visit www.dezyneecole.com
Namita Bakoliya, Diploma Fashion Design First Year, (Corel Draw Project)dezyneecole
Portfolio Of Student Of Dezyne E'cole College , Namita Bakoliya, First Year Fashion Design.This Is The Portfolio Of Her Work From First Year .For More Details Visit www.dezyneecole.com
Portfolio Of Student Of Dezyne E'cole College,Sheikh Anjum Firdoush , Second Year Fashion Design.This Is The Portfolio Of Her Work From Second Year .For More Details Visit www.dezyneecole.com
Portfolio Of Student Of Dezyne E'cole College,Sheikh Anjum Firdoush , Second Year Fashion Design.This Is The Portfolio Of Her Work From Second Year .For More Details Visit www.dezyneecole.com
Gouri Ramchandani, Diploma Fashion Design First Year, (Embroidery Project)dezyneecole
Portfolio Of Student Of Dezyne E'cole College, Gouri Ramchandani, First Year Fashion Design.This Is The Portfolio Of Her Work From First Year .For More Details Visit www.dezyneecole.com
Gouri Ramchandani, Diploma Fashion Design First Year, (Corel DrawProject)dezyneecole
Portfolio Of Student Of Dezyne E'cole College, Gouri Ramchandani, First Year Fashion Design.This Is The Portfolio Of Her Work From First Year .For More Details Visit www.dezyneecole.com
Dimple Mordani, Diploma Fashion Design First Year, (illustration for Fashion ...dezyneecole
Portfolio Of Student Of Dezyne E'cole College , Dimple Mordani, First Year Fashion Design.This Is The Portfolio Of Her Work From First Year .For More Details Visit www.dezyneecole.com
Dimple Mordani, Diploma Fashion Design First Year, (Design Basics Project)dezyneecole
Portfolio Of Student Of Dezyne E'cole College , Dimple Mordani, First Year Fashion Design.This Is The Portfolio Of Her Work From First Year .For More Details Visit www.dezyneecole.com
Dimple Mordani, Diploma Fashion Design First Year, (Corel Draw Project)dezyneecole
Portfolio Of Student Of Dezyne E'cole College , Dimple Mordani, First Year Fashion Design.This Is The Portfolio Of Her Work From First Year .For More Details Visit www.dezyneecole.com
Operation “Blue Star” is the only event in the history of Independent India where the state went into war with its own people. Even after about 40 years it is not clear if it was culmination of states anger over people of the region, a political game of power or start of dictatorial chapter in the democratic setup.
The people of Punjab felt alienated from main stream due to denial of their just demands during a long democratic struggle since independence. As it happen all over the word, it led to militant struggle with great loss of lives of military, police and civilian personnel. Killing of Indira Gandhi and massacre of innocent Sikhs in Delhi and other India cities was also associated with this movement.
The Roman Empire A Historical Colossus.pdfkaushalkr1407
The Roman Empire, a vast and enduring power, stands as one of history's most remarkable civilizations, leaving an indelible imprint on the world. It emerged from the Roman Republic, transitioning into an imperial powerhouse under the leadership of Augustus Caesar in 27 BCE. This transformation marked the beginning of an era defined by unprecedented territorial expansion, architectural marvels, and profound cultural influence.
The empire's roots lie in the city of Rome, founded, according to legend, by Romulus in 753 BCE. Over centuries, Rome evolved from a small settlement to a formidable republic, characterized by a complex political system with elected officials and checks on power. However, internal strife, class conflicts, and military ambitions paved the way for the end of the Republic. Julius Caesar’s dictatorship and subsequent assassination in 44 BCE created a power vacuum, leading to a civil war. Octavian, later Augustus, emerged victorious, heralding the Roman Empire’s birth.
Under Augustus, the empire experienced the Pax Romana, a 200-year period of relative peace and stability. Augustus reformed the military, established efficient administrative systems, and initiated grand construction projects. The empire's borders expanded, encompassing territories from Britain to Egypt and from Spain to the Euphrates. Roman legions, renowned for their discipline and engineering prowess, secured and maintained these vast territories, building roads, fortifications, and cities that facilitated control and integration.
The Roman Empire’s society was hierarchical, with a rigid class system. At the top were the patricians, wealthy elites who held significant political power. Below them were the plebeians, free citizens with limited political influence, and the vast numbers of slaves who formed the backbone of the economy. The family unit was central, governed by the paterfamilias, the male head who held absolute authority.
Culturally, the Romans were eclectic, absorbing and adapting elements from the civilizations they encountered, particularly the Greeks. Roman art, literature, and philosophy reflected this synthesis, creating a rich cultural tapestry. Latin, the Roman language, became the lingua franca of the Western world, influencing numerous modern languages.
Roman architecture and engineering achievements were monumental. They perfected the arch, vault, and dome, constructing enduring structures like the Colosseum, Pantheon, and aqueducts. These engineering marvels not only showcased Roman ingenuity but also served practical purposes, from public entertainment to water supply.
We all have good and bad thoughts from time to time and situation to situation. We are bombarded daily with spiraling thoughts(both negative and positive) creating all-consuming feel , making us difficult to manage with associated suffering. Good thoughts are like our Mob Signal (Positive thought) amidst noise(negative thought) in the atmosphere. Negative thoughts like noise outweigh positive thoughts. These thoughts often create unwanted confusion, trouble, stress and frustration in our mind as well as chaos in our physical world. Negative thoughts are also known as “distorted thinking”.
Ethnobotany and Ethnopharmacology:
Ethnobotany in herbal drug evaluation,
Impact of Ethnobotany in traditional medicine,
New development in herbals,
Bio-prospecting tools for drug discovery,
Role of Ethnopharmacology in drug evaluation,
Reverse Pharmacology.
How to Split Bills in the Odoo 17 POS ModuleCeline George
Bills have a main role in point of sale procedure. It will help to track sales, handling payments and giving receipts to customers. Bill splitting also has an important role in POS. For example, If some friends come together for dinner and if they want to divide the bill then it is possible by POS bill splitting. This slide will show how to split bills in odoo 17 POS.
This is a presentation by Dada Robert in a Your Skill Boost masterclass organised by the Excellence Foundation for South Sudan (EFSS) on Saturday, the 25th and Sunday, the 26th of May 2024.
He discussed the concept of quality improvement, emphasizing its applicability to various aspects of life, including personal, project, and program improvements. He defined quality as doing the right thing at the right time in the right way to achieve the best possible results and discussed the concept of the "gap" between what we know and what we do, and how this gap represents the areas we need to improve. He explained the scientific approach to quality improvement, which involves systematic performance analysis, testing and learning, and implementing change ideas. He also highlighted the importance of client focus and a team approach to quality improvement.
Apurv Gupta, BCA ,Final year , Dezyne E'cole College
1. Oracle Assessment
A WORK REPORT SUBMITTED
IN PARTIAL FULLFILLMENT OF THE REQUIREMENT FOR THE DEGREE
Bachelor of Computer Application
Dezyne E’cole College
106/10, CIVIL LINES
AJMER
RAJASTHAN - 305001 (INDIA)
(JUNE, 2015)
www.dezyneecole.com
SUBMITTED BY
APURV GUPTA
CLASS: BCA 3RD
YEAR
2. 1
PROJECT ABSTRACT
I am APURV GUPTA Student of 3rd year doing my Bachelor Degree in Computer
Application.
In the following pages I gave compiled my work learnt during my 3rd year at college.
The subject is RDBMS. These assessments are based on Relational Database
Management System that is useful to work with front end (user interface) application.
Take example of an online form if the user filling up an online form (E.g. SBI Form,
Gmail registration Form) on to the internet whenever he/she clicks on the submit
button the field value is transfer to the backend database and stored in Oracle, MS-
Access, My SQL, SQL Server.
The purpose of a database is to store and retrieve related information later on. A
database server is the key to solving the problems for information management.
In these assessment we are using Oracle 10g as the Relation Database Software.
The back-end database is a database that is accessed by user indirectly through an
external application rather than by application programming stored within the
database itself or by low level manipulation of the data (e.g. through SQL commands).
Here in the following assessment we are performing the following operations:
1. Creating tables to store the data into tabular format (schemas of the data base)
2. Fetching the data from the database (Using Select Query)
3. Joining the multiple data tables into one (To reduces the redundancy of the data)
4. Nested Queries (Queries within Queries)
4. 3
1. Create an Employee Table (Emp) with Following Fields:
FIELDS DATA TYPE SIZE
EMPNO NUMBER 4
ENAME VARCHAR2 20
DEPTNO NUMBER 2
JOB VARCHAR2 20
SAL NUMBER 5
COMM NUMBER 4
MGR NUMBER 4
HIREDATE DATE -
CREATE TABLE EMP
(EMPNO NUMBER (4),
ENAME VARCHAR2 (20),
DEPTNO NUMBER (2),
JOB VARCHAR2(20),
SAL NUMBER (5),
COMM NUMBER (4),
HIREDATE DATE);
How to display structure of emp table
Solution:
Desc emp;
Output:
Insert Atleast 5 records
6. 5
CREATE TABLE DEPT
(DEPTNO NUMBER(2),
DNAME VARCHAR2(20),
LOC VARCHAR2(20));
How to display structure of dept table
Solution:
Desc dept
Output:
Insert At least 5 records.
Output:
3. Create a SalGrade Table with Following Fields:
7. 6
FIELDS DATA TYPE SIZE
GRADE NUMBER 1
LOSAL NUMBER 5
HISAL NUMBER 5
CREATE TABLE SALGRADE
(GRADE NUMBER(1),
LOSAL VARCHAR2(5),
HISAL VARCHAR2(5));
How to display structure of salgrade table
Solution:
Desc salgrade:
Output:
Insert Atleast 5 records.
Output:
8. 7
SELECT STATEMENT
1. List all the information about all Employees.
Solution:
Select * from emp;
Output:
2. Display the Name of all Employees along with their Salary.
Solution:
Select ename,sal from emp;
Output:
3. List all the Employee Names who is working with Department Number is 20.
Solution:
Select ename from emp
Where deptno=20;
Output:
9. 8
4. List the Name of all ‘MANAGER’ and ‘SALESMAN’.
Solution:
Select ename from emp
Where job=’manager’ and job=’salesman’;
Output:
5. Display the details of those Employees who have joined before the end of Sept.
1981.
Solution:
Select * from emp
where hiredate<'1-sep-1981';
Output:
6. List the Employee Name and Employee Number, who is ‘MANAGER’.
Solution:
Select ename,empno from emp
Where job=’manager’;
Output:
10. 9
7. List the Name and Job of all Employees who are not ‘CLERK’.
Solution:
Select ename,job from emp where job!='clerk';
Output:
8. List the Name of Employees, whose Employee Number is 7369,7521,7839,7934
or 7788.
Solution:
Select ename from emp
where empno=7369 or empno=7521 or empno=7839 or empno=7934 or
empno=7788;
Output:
9. List the Employee detail who does not belongs to Department Number 10 and
30.
Solution:
11. 10
Select * from emp
where deptno!=10 and deptno!=30;
Output:
10.List the Employee Name and Salary, whose Salary is vary from 10000 to 20000.
Solution:
select ename,sal from emp
where sal between 10000 and 20000;
Output:
11.List the Employee Names, who have joined before 30-Jun-1981 and after Dec-
1981.
Solution:
Select ename from emp
where hiredate<'30-jun-1981' or hiredate>'31-dec-1981';
Output:
12. 11
12.List the Commission and Name of Employees, who are availing the
Commission.
Solution:
Select ename,comm from emp
where comm is not null;
Output:
13.List the Name and Designation (job) of the Employees who does not report to
anybody.
Solution:
Select ename,job from emp
where mgr!=0;
Output:
13. 12
14.List the detail of the Employees, whose Salary is greater than 2000 and
Commission is NULL.
Solution:
Select * from emp
where sal>2000 and comm is null;
Output:
15.List the Employee details whose Name start with ‘S’.
Solution:
Select * from emp
where ename like 's%';
Output:
16.List the Employee Names and Date of Joining in Descending Order of Date of
Joining. The column title should be “Date Of Joining”.
Solution:
Select ename,hiredate as "date of joining" from emp
order by "date of joining" desc;
Output:
14. 13
17.List the Employee Name, Salary, Job and Department Number and display it in
Descending Order of Department Number, Ascending Order of Name and
Descending Order of Salary.
Solution:
Select ename,sal,job,deptno from emp
order by deptno desc,ename asc ,sal desc;
Output:
18.List the Employee Name, Salary, PF, HRA, DA and Gross Salary; Order the result
in Ascending Order of Gross Salary. HRA is 50% of Salary, DA is 30% and PF is
10%.
Solution:
Select ename,sal+(sal*50)/100+(sal*30)/100-(sal*10)/100 as "gross salary" from emp;
order by "gross salary" asc;
Output:
15. 14
19.List Salesman from dept No 20.
Solution:
Select * from emp
where job='salesman' and deptno=20;
Output:
20.List Clerks from 20 and salesman from 30. In the list the lowest earning
employee must at top.
Solution:
Select * from emp
where job='clerk' and deptno=15 or job='salesman'and deptno=30
order by sal asc;
Output:
21.List different departments from Employee table.
Solution:
Select distinct deptno from emp;
16. 15
Output:
22.List employees having “G” at the end of their Name.
Solution:
Select * from emp
where ename like'%g';
Output:
23.List employee who are not managed by anyone.
Solution:
Select * from emp
where mgr is null;
Output:
17. 16
24.List employees who are having “TT” or “LL” in their names.
Solution:
Select * from emp
where ename like'%tt%' or ename like'%ll%';
Output:
25.List employees earning salaries below 1500 and more than 3000.
Solution:
Select * from emp
where sal<1500 or sal>3000;
Output:
26.List employees who are drawing some commission. Display their total salary as
well.
Solution:
Select ename,(sal+comm) from emp
where comm is not null;
18. 17
Output:
27.List employees who are drawing more commission than their salary. Only those
records should be displayed where commission is given (also sort the output
in the descending order of commission).
Solution:
Select * from emp
where comm is not null and comm>sal
order by comm desc;
Output:
28.List the employees who joined the company in the month of “JAN”.
Solution:
Select * from emp
where hiredate between'1-jan-1985' and '31-jan-1985';
Output:
29.List employees who are working as salesman and having names of four
characters.
19. 18
Solution:
Select * from emp
where job='salesman' and ename like'____';
Output:
30.List employee who are managed by 7839.
Solution:
Select * from emp
where mgr=7839;
Output:
20. 19
GROUPING, HAVING ETC.
1. List the Department number and total number of employees in each department.
Solution:
Select deptno,count(empno) from emp
group by deptno;
Output:
2. List the different Job names (Designation) available in the EMP table.
Solution:
Select distinct job from emp;
Output:
3. List the Average Salary and number of Employees working in Department
number 20.
Solution:
Select avg(sal),count(empno) from emp
where deptno=20;
Output:
21. 20
4. List the Department Number and Total Salary payable at each Department.
Solution:
Select deptno,sum(sal+comm) from emp
group by deptno;
Output:
5. List the jobs and number of Employees in each Job. The result should be in
Descending Order of the number of Employees.
Solution:
Select job,count(empno) from emp
group by job
order by count(empno) desc;
Output:
6. List the Total salary, Maximum Salary, Minimum Salary and Average Salary of
Employees job wise, for Department number 10 only.
22. 21
Solution:
Select job,sum(sal+comm),max(sal),min(sal),avg(sal) from emp
where deptno=10
group by job;
Output:
7. List the Average Salary of each Job, excluding ‘MANAGERS’.
Solution:
Select job,avg(sal) from emp
where job!='manager'
group by job;
Output:
8. List the Average Monthly Salary for each Job within each department.
Solution:
Select avg(sal),deptno from emp
group by job,deptno;
Output:
23. 22
9. List the Average Salary of all departments, in which more than one people are
working.
Solution:
Select avg(sal),count(empno) from emp
group by job,deptno
having count(empno)>1;
Output:
10.List the jobs of all Employees where Maximum Salary is greater than or equal
to 5000.
Solution:
Select job,max(sal) from emp
group by job
having max(sal)>=5000;
Output:
24. 23
11.List the total salary and average salary of the Employees job wise, for
department number 20 and
display only those rows having average salary greater than 1000.
Solution:
Select sum(sal+comm),avg(sal) from emp
where deptno=20
group by job
having max(sal)>1000;
Output:
12.List the total salaries of only those departments in which at least 3 employees
are working.
Solution:
Select sum(sal+comm),count(empno),deptno from emp
group by deptno
having count(empno)>=3;
Output:
13.List the Number of Employees Managed by Each Manager
25. 24
Solution:
Select count(empno) from emp
group by mgr;
Output:
14.List Average Commission Drawn by all Salesman
Solution:
Select avg(comm),job from emp
where job='salesman'
group by job;
Output:
26. 25
FUNCTIONS
1. Calculate the remainder for two given numbers. (213,9)
Solution:
Select mod(213,9) from dual;
Output:
2. Calculate the power of two numbers entered by the users at run time of the
query.
Solution:
Select power(:first,:second) from dual;
Output:
3. Enter a number and check whether it is negative or positive.
Solution:
Select sign(:a) from dual;
Output:
27. 26
4. Calculate the square root for the given number. (i.e. 10000).
Solution:
Select sqrt(10000) from dual;
Output:
5. Enter a float number and truncate it up to 1 and -2 places of decimal.
Solution:
Select trunc(:a,1),trunc(:b,-2) from dual;
Output:
6. Find the rounding value of 563.456, up to 2, 0 and -2 places of decimal.
Solution:
Select round(563.456,2) as "upto2" ,round(563.456,0) as "upto0" ,round(563.456,-2)
as "upto-2" from dual;
Output:
28. 27
7. Accept two numbers and display its corresponding character with the
appropriate title.
Solution:
Select chr(:num) from dual;
Output:
8. Input two names and concatenate it separated by two spaces.
Solution:
Select :n || ' ' || :n1 from dual;
Output:
9. Display all the Employee names-with first character in upper case from EMP
table.
Solution:
Select initcap(:a) from dual;
Output:
29. 28
10.Display all the department names in upper and lower cases.
Solution:
Select upper(dname),lower(dname) from dept;
Output:
11.Extract the character S and A from the left and R and N from the right of the
Employee name from EMP table.
Solution:
Select ename,ltrim(ename,'sa'),rtrim(ename,'rn') from emp;
Output:
30. 29
12.Change all the occurrences of C with P in job domain.
Solution:
Select translate(job,'c','p') from emp;
Output:
13.Display the information of those Employees whose name has the second
character A.
Solution:
31. 30
Select * from emp
where instr(ename,'a')=2;
Output:
14.Display the ASCII code of the character entered by the user.
Solution:
Select ascii(:n) from dual;
Output:
15.Display the Employee names along with the location of the character A in the
Employees name from EMP table where the job is CLERK.
Solution:
Select ename,instr(ename,'a')from emp
where job='clerk';
Output:
32. 31
16.Find the Employee names with maximum number of characters in it.
Solution:
Select max(length(ename)) from emp;
Output:
17.Display the salary of those Employees who are getting salary in three figures.
Solution:
Select sal from emp
where length(sal)=4;
Output:
18.Display only the first three characters of the Employees name and their H RA
(salary * .20), truncated to decimal places.
Solution:
Select substr(ename,1,3),trunc(sal*.20) from emp;
Output:
33. 32
19.List all the Employee names, who have more than 20 years of experience in the
company.
Solution:
Select ename from emp
where round(months_between(sysdate,hiredate)/12)>20;
Output:
20.Display the name and job for every Employee, while displaying jobs, 'CLERK'
should be displayed as 'LDC' and 'MANAGER' should be displayed as 'MNGR'.
The other job title should be as they are.
Solution:
34. 33
Select ename,job,decode(job,'clerk','LDC','manager','MNGR')promotion from emp;
Output:
21.Display Date in the Following Format Tuesday 31 December 2002.
Solution:
Select to_char(sysdate,'day') || to_char(sysdate,'dd-month-yyyy') from dual;
Output:
22.Display the Sunday coming After 3 Months from Today’s Date.
Solution:
Select next_day(add_months(sysdate,3),1) from dual;
Output:
35. 34
Coverage Joins
1. List Employee Name, Job, Salary, Grade & the Location where they are working
Solution:
Select e.ename,e.job,e.sal,s.grade,d.loc from emp e join dept d on e.deptno=d.deptno
join salgrade s on e.sal between losal and hisal;
Output:
2. Count the Employees For Each Salary Grade for Each Location
Solution:
Select count(e.empno),s.grade,d.loc from emp e join salgrade s on e.sal between
losal and hisal join dept d on e.deptno=d.deptno group by s.grade,d.loc;
Output:
36. 35
3. List the Average Salary for Those Employees who are drawing salaries of grade
is 3
Solution:
Select avg(e.sal),s.grade from emp e join salgrade s on e.sal between losal and hisal
where s.grade=3 group by s.grade;
Output:
4. List Employee Name, Job, Salary Of those employees who are working in
Accounting or Finance department but drawing salaries of grade 3
Solution:
Select e.ename,e.job,e.sal,d.dname,s.grade from emp e join dept d on
e.deptno=d.deptno join salgrade s on e.sal between losal and hisal where
(d.dname=’accounting’ or d.dname=’finance’)and s.grade=3;
Output:
5. List employee Names, Manager Names & also Display the Employees who are
not managed by anyone
37. 36
Solution:
Select e.ename,m.ename from emp e left outer join emp m on e.empno=m.mgr;
Output:
6. List Employees who are drawing salary more than the salary of SCOTT
Solution:
Select e.* from emp e join emp f on e.sal>f.sal where f.ename='scott';
Output:
38. 37
7. List Employees who have joined the company after their managers
Solution:
Select e.* from emp e join emp m on e.empno=m.mgr where e.hiredate>m.hiredate
Output:
8. List Employee Name, Job, Salary, Department No, Department name and
Location Of all employees Working at NEW YORK
Solution:
Select ename,job,sal,deptno,dname,loc from emp join dept using(deptno) where
loc=’new york’;
Output:
9. List Employee Name, Job, Salary, Hire Date and Location Of all employees
reporting in Accounting or Sales Department
Solution:
Select ename,job,sal,hiredate,loc from emp join dept using(deptno) where
dname=’accounting’ or dname=’sales’;
Output:
39. 38
10.List Employee Name, Job, Salary, Department Name, Location for Employees
drawing salary more than 2000 and working at New York or Dallas
Solution:
Select ename,job,sal,dname,loc from emp join dept using(deptno) where sal>2000
and loc=’newyork’ or loc=’udaipur’;
Output:
11. List Employee Name, Job, Salary, Department Name, Location Of all
employees, also list the Department Details in which no employee is working
Solution:
Select e.ename,e.sal,d.dname,d.loc from emp e right outer join dept d on
e.deptno=d.deptno;
Output:
41. 40
Nested and Correlated sub queries
1. List Employees who are working in the Sales Department (Use Nested)
Solution:
Select * from emp where deptno=(Select deptno from dept where dname=’sales’);
Output:
2. List Departments in which at least one employee is working (Use Nested)
Solution:
Select dname from dept where deptno in(Select deptno from emp);
Output:
3. Find the Names of employees who do not work in the same department of Scott.
Solution:
Select ename from emp where deptno<>(Select deptno from emp where
ename=’scott’);
Output:
42. 41
4. List departments (dept details) in which no employee is working (use nested)
Solution:
Select dname from dept where deptno<>all(Select deptno from emp);
output:
5. List Employees who are drawing the Salary more than the Average salary of
DEPTNO 30. Also ensure that the result should not contain the records of
DEPTNO 30
Solution:
Select * from emp where sal>(Select avg(sal)from emp where deptno=30)and
deptno!=30;
Output:
43. 42
6. List Employee names drawing Second Maximum Salary
Solution:
Select ename from emp where sal=(Select (max(sal)) from emp where sal<(Select
(max(sal)) from emp));
Output:
7. List the Employee Names, Job & Salary for those employees who are drawing
minmum salaries for their department (Use Correlated)
Solution:
Select ename,job,sal from emp e
where sal=(Select min(sal)from emp i where e.deptno=i.deptno);
Output:
8. List the highest paid employee for each department using correlated sub query.
Solution:
Select * from emp e where e.sal=(Select max(sal) from emp i where
i.deptno=e.deptno);
Output:
44. 43
9. List Employees working for the same job type as of KING and drawing more
than him (use Self Join)
Solution:
Select e.* from emp e join emp f on e.job=f.job where e.sal>f.sal and e.ename='king';
Output: