• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Sql task
 

Sql task

on

  • 1,000 views

Sql task

Sql task

Statistics

Views

Total Views
1,000
Views on SlideShare
1,000
Embed Views
0

Actions

Likes
0
Downloads
2
Comments
1

0 Embeds 0

No embeds

Accessibility

Upload Details

Uploaded via as Microsoft Word

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel

11 of 1 previous next

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
  • thanks but what i needed is
    BEGIN
    IF(LENGTH(TRIM(TRANSLATE(:audit_plan_mas.audit_plan_year, ' +-.0123456789', ' ')))IS NULL) THEN--if null then its numberic
    IF(TO_NUMBER(:audit_plan_mas.audit_plan_year)>1900)THEN
    message(' Please ; Enter a valid Year Larger than 1900');
    message(' Please ; Enter a valid Year Larger than 1900');
    RAISE form_trigger_failure;
    END IF;
    END IF;

    EXCEPTION

    WHEN OTHERS THEN
    message(' Please ; Enter a valid Year Larger than 1900');
    message(' Please ; Enter a valid Year Larger than 1900');
    RAISE form_trigger_failure;

    END;
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Sql task Sql task Document Transcript

    • Human Resources (HR)This is the schema that is used in this course. In the Human Resource (HR) records, each employeehas an identification number, email address, job identification code, salary, and manager. Someemployees earn commissions in addition to their salary.The company also tracks information about jobs within the organization. Each job has anidentification code, job title, and a minimum and maximum salary range for the job. Someemployees have been with the company for a long time and have held different positions within thecompany. When an employee resigns, the duration the employee was working for, the jobidentification number, and the department are recorded.The sample company is regionally diverse, so it tracks the locations of its warehouses anddepartments. Each employee is assigned to a department, and each department is identified eitherby a unique department number or a short name. Each department is associated with one location,and each location has a full address that includes the street name, postal code, city, state orprovince, and the country code.In places where the departments and warehouses are located, the company records details such asthe country name, currency symbol, currency name, and the region where the country is locatedgeographically.
    • HR Schema:COUNTRIESDEPARTMENTSEMPLOYEESJOB_GRADESJOB_HISTORYJOBSLOCATIONSREGIONSTask:1)Write a query that displays the last name (with the first letter in uppercase and all the other letters inlowercase) and the length of the last name for all employees whose name starts with the letters “J,”“A,” or “M.” (Use Employees table)2)Write a query which will print the employees last_name, no.of months worked till date and theirmanager name.Label the columns with the following: Employee – Experience in months – Manager Id3)Create a query that displays the first eight characters of the employees’ last names and indicates theamounts of their salaries with asterisks. Each asterisk signifies a thousand dollars. Sort the data indescending order of salary. Label the column EMPLOYEES_AND_THEIR_SALARIES.4)Create a query to display the last name and the number of weeks employed for allemployees in department 90. Label the number of weeks column TENURE. Truncatethe number of weeks value to 0 decimal places. Show the records in descending orderof the employee’s tenure.
    • 5)Display each employee’s last name, hire date, and salary review date, which is the first Monday aftersix months of service. Label the column REVIEW. Format the dates to appear in the format similar to“Monday, the Thirty-First of July, 2000.”6)Create a report to display the manager number and the salary of the lowest-paidemployee for that manager. Exclude anyone whose manager is not known. Excludeany groups where the minimum salary is $6,000 or less. Sort the output in descendingorder of salary.7)Create a query to display the total number of employees and, of that total, the numberof employees hired in 1995, 1996, 1997, and 1998. Create appropriate columnheadings.8)Create a matrix query to display the job, the salary for that job based on departmentnumber, and the total salary for that job, for departments 20, 50, 80, and 90, givingeach column an appropriate heading.
    • 9)Create a query that displays the employee last name, job title, department name, salary, and grade forall employees. (Tables to be used Employees, Departments, Jobs)10)Write a query to find the names and hire dates of all the employees who were hired before theirmanagers, along with their managers’ names and hire dates.11)Write a query that displays the employee number and last name of all employees whowork in a department with any employee whose last name contains the letter “u.”
    • 12)Create a table MY_EMPLOYEE which is a replicate of EMPLOYEES table with all the data.13)Add a new column USER_ID to MY_EMPLOYEE table and enforce a unique constraint.14)Update the USER_ID column of MY_EMPLOYEE table with the following format.user_id should contain first letter of the last_name concatenated with first_name of the employee andthe maximum length of the user_id should be 8.15)Change the salary to $1,000 for all employees who have a salary less than $900 in MY_EMPLOYEEtable.16)Create a view named DEPT50 that contains the employee numbers, employee last names, anddepartment numbers for all employees in department 50. Label the view columns EMPNO, EMPLOYEE,and DEPTNO. For security purposes, do not allow an employee to be reassigned to another departmentthrough the view.17)Show all employees who were hired on the day of the week on which the highest number of employeeswere hired.18)Write a query to get the nth highest salary among the employees.Query should accept a value for n.If n = 2, then it should retrieve all the employee names who are earning 2nd highest salary among theemployees.19)Suppose the primary key constraint has been disabled on employee_id column and users have enteredduplicate employee_ids within the employee table.Write a query to remove the duplicate rows from the table and preserve the original employee_id whichwas existing.