Download as pdf or txt
Download as pdf or txt
You are on page 1of 32

ADITI NEGI MCA C ROLL NO-07 STUDENT ID-22392177

ASSIGNMENT – 5 (SINGLE ROW FUNCTIONS)


PROBLEM STATEMENT: Create emp table from hr.employees
QUERY:

OUTPUT:

PROBLEM STATEMENT: List the Enames those are having five


characters in their first names.
QUERY:

OUTPUT:
ADITI NEGI MCA C ROLL NO-07 STUDENT ID-22392177

PROBLEM STATEMENT: List the Enames those are starting with ‘S’ and
with five characters in their firstname.
QUERY:

OUTPUT:

PROBLEM STATEMENT: . List the Five character names starting with ‘S’
and ending with ‘H’.
QUERY:

OUTPUT:
ADITI NEGI MCA C ROLL NO-07 STUDENT ID-22392177

PROBLEM STATEMENT: Display the employee last_name concatenated


with first_name, the length of the employee last_name .

QUERY:

OUTPUT:
ADITI NEGI MCA C ROLL NO-07 STUDENT ID-22392177

PROBLEM STATEMENT: Write a query that display the employee’s last


names with the first letter capitalized & all other letters lowercase & length of
the names for all employees whose name stats with J, A or M. Also sort the
results by employees last name.

QUERY:

OUTPUT:
ADITI NEGI MCA C ROLL NO-07 STUDENT ID-22392177

PROBLEM STATEMENT: Calculate the remainder of a salary after it is


divided by 5000 for all employees whose job_id is SA_REP.
QUERY:

OUTPUT:

PROBLEM STATEMENT: . For each employee, display the employee


number, last_name & salary increased by 15% & expresses as a whole number.
QUERY:

OUTPUT:
ADITI NEGI MCA C ROLL NO-07 STUDENT ID-22392177

PROBLEM STATEMENT: Create a query to display the last name & salary
for all employees. Format the salary to be 15 characters long, left padded with
$. Label the column Salary.

QUERY:

OUTPUT:
ADITI NEGI MCA C ROLL NO-07 STUDENT ID-22392177

PROBLEM STATEMENT: Calculate the job experience of all employees.


Display it with hiredate and the new column heading Experience in months and
experience in years.

QUERY:

OUTPUT:
ADITI NEGI MCA C ROLL NO-07 STUDENT ID-22392177

PROBLEM STATEMENT: Display the employee number, hiredate, number


of months employed, six month review date, first Friday after hire date and last
day of the hiremonth for all employees.

QUERY:

OUTPUT:
ADITI NEGI MCA C ROLL NO-07 STUDENT ID-22392177

PROBLEM STATEMENT: Display the employees last name & calculate the
number of months between today & date the employee was hired. Label this
column as months_worked.

QUERY:

OUTPUT:
ADITI NEGI MCA C ROLL NO-07 STUDENT ID-22392177

PROBLEM STATEMENT: Display the names & hiredate along with the
time of all the employees who joined on May 24,1999.
QUERY:

OUTPUT:

PROBLEM STATEMENT: To find employees hired before 1990.


QUERY:

OUTPUT:
ADITI NEGI MCA C ROLL NO-07 STUDENT ID-22392177

PROBLEM STATEMENT: Display each employee last name, hire date & day
of the week on which the employee started. Order the results y the day of the
week .

QUERY:

OUTPUT:
ADITI NEGI MCA C ROLL NO-07 STUDENT ID-22392177

PROBLEM STATEMENT: Create a query that display the employees last


name & comm. Amounts. If an employee does not earn commission put, ”No
commission”.

QUERY:

OUTPUT:
ADITI NEGI MCA C ROLL NO-07 STUDENT ID-22392177

PROBLEM STATEMENT: Create a query to calculate the annual salary and


annual compensation of all the employees.

QUERY:

OUTPUT:
ADITI NEGI MCA C ROLL NO-07 STUDENT ID-22392177

PROBLEM STATEMENT: Create a query that display the employees last


name & manager_id . If an employee does not have manager display , ”No
manager”

QUERY:

OUTPUT:
ADITI NEGI MCA C ROLL NO-07 STUDENT ID-22392177

ASSIGNMENT-6 (JOINS)
PROBLEM STATEMENT: Display the employees-id,employee name,dept_id
& department name for all the employees.
QUERY:

OUTPUT:
ADITI NEGI MCA C ROLL NO-07 STUDENT ID-22392177

PROBLEM STATEMENT: Display the employee smith department number


& department name.
QUERY:

OUTPUT:
ADITI NEGI MCA C ROLL NO-07 STUDENT ID-22392177

PROBLEM STATEMENT: Display the employee last name, department


name & city for each employee whose salary is greater than 2000.

QUERY:

OUTPUT:
ADITI NEGI MCA C ROLL NO-07 STUDENT ID-22392177

PROBLEM STATEMENT: Display the employee last name & department


name for all employees who have ‘a’ in their last name.
QUERY:

OUTPUT:
ADITI NEGI MCA C ROLL NO-07 STUDENT ID-22392177

PROBLEM STATEMENT: Display the employee last name & employee


number along with their manager last name & manager number. The output
should be in the following sequence
(employee_lastname,emp_id,manager_lastname,manager_id)
QUERY:

OUTPUT:
ADITI NEGI MCA C ROLL NO-07 STUDENT ID-22392177

ASSINGMENT- 7 ( GROUP FUNCTIONS )


PROBLEM STATEMENT: List minimum , maximum , average salaries of
employee.
QUERY:

OUTPUT:
ADITI NEGI MCA C ROLL NO-07 STUDENT ID-22392177

PROBLEM STATEMENT: Find how many job titles are available in


employee table.
QUERY:

OUTPUT:

PROBLEM STATEMENT: What is the difference between maximum and


minimum salaries of employees in the organization.
QUERY:

OUTPUT:
ADITI NEGI MCA C ROLL NO-07 STUDENT ID-22392177

PROBLEM STATEMENT: Find how much amount the company is spending


towards salaries.
QUERY:

OUTPUT:

PROBLEM STATEMENT: Calculate the average salary of all employees.


QUERY:

OUTPUT:
ADITI NEGI MCA C ROLL NO-07 STUDENT ID-22392177

PROBLEM STATEMENT: Count the number of records in emp table.


QUERY:

OUTPUT:

PROBLEM STATEMENT: To calculate the number of employees in each


dept.
QUERY:

OUTPUT:
ADITI NEGI MCA C ROLL NO-07 STUDENT ID-22392177

PROBLEM STATEMENT: Calculate the maximum, minimum salary for each


department.
QUERY:

OUTPUT:

PROBLEM STATEMENT: Display the job where the number of employees is


less than 3.
QUERY:

OUTPUT:
ADITI NEGI MCA C ROLL NO-07 STUDENT ID-22392177

PROBLEM STATEMENT: Display the department number & average


salaries for those department whose maximum salary greater than 10,000.
QUERY:

OUTPUT:
ADITI NEGI MCA C ROLL NO-07 STUDENT ID-22392177

PROBLEM STATEMENT: Display the job_id & total monthly salary for each
job with a total payroll exceeding 13000 & sort the result by total monthly
salary & jobid does not contain MAN.

QUERY:

OUTPUT:
ADITI NEGI MCA C ROLL NO-07 STUDENT ID-22392177

ASSIGNMENT – 9( ALTER COMMAND)


PROBLEM STATEMENT: Create the emp_new table

QUERY:

OUTPUT:
ADITI NEGI MCA C ROLL NO-07 STUDENT ID-22392177

PROBLEM STATEMENT: Create the dept table

QUERY:

OUTPUT:

PROBLEM STATEMENT: Modify the emp_new table to allow the longer


employee last_name by increasing the width of the column by 50.
QUERY:

OUTPUT:
ADITI NEGI MCA C ROLL NO-07 STUDENT ID-22392177

PROBLEM STATEMENT: Drop the first name column from emp_new table.
Confirm your modification by checking the description of the table.
QUERY:

OUTPUT:

PROBLEM STATEMENT: Rename the dept-id column as deptno.


QUERY:

OUTPUT:
ADITI NEGI MCA C ROLL NO-07 STUDENT ID-22392177

PROBLEM STATEMENT: Rename the table emp_new as employee.


QUERY:

OUTPUT:
ADITI NEGI MCA C ROLL NO-07 STUDENT ID-22392177

PROBLEM STATEMENT: Create a primary key constraint to the dept table


on dept_id column. The constraint should be named at creation. Name the
constraint my_dept_id_pk.
QUERY:

OUTPUT:
ADITI NEGI MCA C ROLL NO-07 STUDENT ID-22392177

PROBLEM STATEMENT: Add a foreign key reference on the emp table that
ensures yhat the employee is not assigned to a nonexistent department. Name
the constraint my_emp_dept_id_fk.
QUERY:

OUTPUT:

PROBLEM STATEMENT: Confirm that the constraints were added by


querying the USER_CONSTRAINTS VIEW
QUERY:

OUTPUT:

You might also like