CPP Assignment-1
CPP Assignment-1
practical
Assignment – 1
Oracle
Submitted by:-
Name: Mayank Sheth
PRN: 09030122056
Div: ”A”
Table Creation
Question -2 Write a query to display ename, sal, comm. And total income (sal
+ Comm) in descending order of total income
Ans - select ename, salary, comm, salary+comm"Total_Income" from emp_56
Question -4 Display the employee number, name, salary, and salary increase
by 15 % expressed as whole number.
Ans - select eno, ename, salary, salary+salary*0.15"inc_sal" from emp_56;
Question -5 For each employee display the employee name and calculate the
number of months between today and the date of the employee was hired.
Order your results by the number of months employed.
Ans - select ename, months_between(sysdate, hiredate)"hired_days" from emp_56
order by "hired_days" desc;
Question -6 Create a query to display the name and salary for all employees.
Format the salary to be 15 characters long, left padded with $. Label the
column SALARY.
Ans - select lpad(salary, 15, '$') from emp_56;