Question

Use the HR database for all the questions in this lab. For each item in this lab, paste the SQL y...

Use the HR database for all the questions in this lab. For each item in this lab, paste the SQL you used to complete the task and the number of rows retrieved. Ensure you follow the coding standards listed in the ETSU SQL standards guide found on D2L. Save this document as a PDF and name it your_name_lab7.pdf

  1. Display the employees’ first name, last name and phone number of employees with salaries greater than 10,000 dollars.

SELECT first_name, last_name, phone_number, salary

FROM hr.employees

WHERE salary > 10000;

Rows Retrieved: 15

  1. Display the department ID, and department name of departments without managers.
  1. Display all the employees in department 50 who joined after the year 1997.
  1. Display the full name of employees (as a single column) and start date who joined on the 15th of any month. (Hint: Use TO_CHAR function)
  1. Assuming the all emails of employees end with “@abcbank.com”, display the full name and their email address of all employees
  1. Assuming each employee pays 5% if their salary as tax, display all the full name, phone number , salary, tax of all employees who’s tax is more than 500 dollars

  1. Password of the format “XXyymmdd” is to be generated for all employees.

Where “XX” is the first two letters of the first name, “yy” is the last two letters of the last name, “mm” is the month of hire while “dd” is the day of hire.

Display all employees full name and password.

  1. Find the employee(s) who work as an IT programmer or Sales Rep, having an ‘a’ as the second character of the first name and with no ‘n’ in the last name.

0 0
Add a comment Improve this question Transcribed image text
Answer #1
  1. Display the department ID, and department name of departments without managers.

SELECT DEPARTMENT_ID,DEPARTMENT_NAME FROM HR.DEPARTMENTS WHERE MANAGER_ID IS NULL;

  1. Display all the employees in department 50 who joined after the year 1997

SELECT * FROM HR.EMPLOYEES WHERE DEPARTMENT_ID=50 AND SUBSTR(HIRE_DATE,1,4)<1997;

  1. Display the full name of employees (as a single column) and start date who joined on the 15th of any month. (Hint: Use TO_CHAR function)

SELECT HE.FIRST_NAME||' '||HE.LAST_NAME , START_DATE FROM HR.JOB_HISTORY HJ JOIN HR.EMPLOYEES HE ON HJ.EMPLOYEE_ID=HE.EMPLOYEE_ID WHERE TO_CHAR(START_DATE,'dd') = 15

  1. Assuming the all emails of employees end with “@abcbank.com”, display the full name and their email address of all employees

SELECT FIRST_NAME||' '||LAST_NAME ,EMAIL||'@abcbank.com' FROM HR.EMPLOYEES

  1. Assuming each employee pays 5% if their salary as tax, display all the full name, phone number , salary, tax of all employees who’s tax is more than 500 dollars

SELECT FIRST_NAME||' '||LAST_NAME ,PHONE_NUMBER,SALARY, (SALARY*0.05) AS TAX FROM HR.EMPLOYEES WHERE (SALARY*0.05)>500;

  1. Password of the format “XXyymmdd” is to be generated for all employees.

Where “XX” is the first two letters of the first name, “yy” is the last two letters of the last name, “mm” is the month of hire while “dd” is the day of hire.

Display all employees full name and password.

SELECT FIRST_NAME||' '||LAST_NAME , SUBSTR(FIRST_NAME,1,2)||SUBSTR(LAST_NAME, LENGTH(LAST_NAME)-2,2)||TO_CHAR(START_DATE,'mm')||TO_CHAR(START_DATE,'dd')  FROM HR.EMPLOYEES

  1. Find the employee(s) who work as an IT programmer or Sales Rep, having an ‘a’ as the second character of the first name and with no ‘n’ in the last name.

SELECT HE.EMPLOYEE_ID FROM HR.EMPLOYEES HE JOIN HR.JOBS HJ ON HE.JOB_ID=HJ.JOB_ID WHERE HJ.JOB_TILE IN ('IT programmer','Sales Rep') AND FIRST_NAME LIKE '_a%' AND LAST_NAME LIKE '%n%';

note: if u have any doubt, let me know.

Add a comment
Know the answer?
Add Answer to:
Use the HR database for all the questions in this lab. For each item in this lab, paste the SQL y...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Please refer to the following business scenarios: (i) Using SELECT statements of SQL, find the employee...

    Please refer to the following business scenarios: (i) Using SELECT statements of SQL, find the employee id, first name, last name, job title and email of all employees working in Asia (i.e. all countries coming from the region     ‘Asia’). This query must be implemented as a nested query! (ii) Using SELECT statements of SQL, find the employee id, first name, last name, job title and supervisor id of employees who had worked for more than 3 years and completed...

  • Write an SQL statement that will display the Employee ID, First name (only last 2 letters),...

    Write an SQL statement that will display the Employee ID, First name (only last 2 letters), phone number (replace . by /) of all employees whose job Id has a word ‘REP’.

  • Using the database: Write SQL queries for each of the questions below. 1. Find the media...

    Using the database: Write SQL queries for each of the questions below. 1. Find the media type which has 100 or more tracks. Print the name of such media type. Number of rows returned in the result = 3 A) Find the playlists which have one or more tracks that have never been purchased in California (CA). Print the Id, and the name of such playlists. Number of rows returned in the result = 18 B) Find the customers who...

  • Write an SQL statement that will display the Employee ID, full name (all capital) and Job...

    Write an SQL statement that will display the Employee ID, full name (all capital) and Job ID of all employees that belong to a department with Department ID 20 and whose Job ID has a substring “rep”.

  • please help me out with these SQL problems: 1. Create a treewalking list of every employee's...

    please help me out with these SQL problems: 1. Create a treewalking list of every employee's last name, his manager's last name, and his position in the company. – The top level manager has position 1, this manager's subordinates position 2, their subordinates position 3, and so on. – Start the listing with employee number 100. 2. create the list of department names and the departmental costs (salaries added up). – Include only departments whose salary costs are between 15000...

  • Write SQL Queries for the following Select the employee name and no of departments each employee...

    Write SQL Queries for the following Select the employee name and no of departments each employee works for Select the employee names with salary greater than average salary of all employees Select the department names with no manager assigned yet. Select the employee names who work for more than 1 department. Select the employee names and their manager names (keep in mind, one employee works for multiple departments so they will have multiple managers). Select the name and salary of...

  • Hi i need to write an SQL Query to list the given for these questions below...

    Hi i need to write an SQL Query to list the given for these questions below Example: SELECT emp_lname -- but it doent seem to work --1. Give a Listing of all the employees having their first name, last name and full name, order the report by the employee's last name --2. Give a listing of all employees that have a last name that begins with the letters between A-K --3. Give a Listing of all the employees having their...

  • database and sql problme THE QUESTIONS 3, 4,5 and 6 REFER TO THE RELATIONAL TABLES LISTED...

    database and sql problme THE QUESTIONS 3, 4,5 and 6 REFER TO THE RELATIONAL TABLES LISTED BELOW CREATE TABLE Department ( DECIMAL(5) VARCHAR(30) CHAR(5) DATE NOT NULL NOT NULL NOT NULL * Department number /*Department name * Department manager number */ /Manager start date DNumber DName Manager MSDate CONSTRAINT Department_PK PRIMARY KEY(DNumber) CONSTRAINT Department_CK UNIQUE(DName) CREATE TABLE DeptLocation DECIMAL(5) VARCHAR(50) NOT NULL NOT NULL DNumber * Department number */ * Department location */ Address CONSTRAINT DeptLocation_PK PRIMARY KEY(DNumber, Address) CONSTRAINT...

  • Use SQL to slove the problem 1. (7) List all condos in building C, the date...

    Use SQL to slove the problem 1. (7) List all condos in building C, the date they were cleaned, and the full name of the staff who cleaned them in August. 2. (5) Display the activities reserved in June for more than 3 people. Include the activity description and label the output as Activities Reserved in June. 3. (4) Listing for all guides and their certification renewal dates for next year. Include full name and hire date. 4. (6) Management...

  • Q.5] Answer the following questions based on the company database (based on the homework assignment 2) y dat...

    Q.5] Answer the following questions based on the company database (based on the homework assignment 2) y database (based on the homework assignment 2) 3 IPage 1. For each department whose average employee salary is more than $30,000, write a SQL statement to retrieve the department name and the number of employees working for that department 2. Write a SQL statement to retrieve first name, last name, and address of each employee who lives in Houston, TX. 3. Write a...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT