Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Hello, this is for Oracle SQL. Table: Employees Employee First_Name Id Last Name

ID: 3874164 • Letter: H

Question

Hello, this is for Oracle SQL.

Table: Employees Employee First_Name Id Last Name Dept Code Credit Limit Phone Manager_id Ext Hire_Date 201 202 203 204 205 206 207 208 209 210 Brown Kern Woods Owens Perkins Rose Smith Campbel1 Jacobs Hoffman 01-Jun-1998 16-Aug-1999 02-Feb-2004 01-Jul-2003 01-Mar-2000 nu1l 01-Dec-2004 01-Apr-2003 17-Mar-1999 16-Feb-2004 $30.00 $25.00 $25.00 $15.00 $25.00 null $25.00 $30.00 $15.00 $25.00 3484(nul1) 8722 7591 6830 5286 null (nul1) 2259 1752 3357 2974 Susan Exe Sa l 201 201 202 202 1 m Martha Ellen Hen Caro Dan Fred Paula Nancy Sa Sal Act Shp Shp Mkt Sal 203 203 201 203 Task#4 : Find how many employees have joined between the year 2002 and 2005 in the accounting department.

Explanation / Answer

This is the query:

SELECT COUNT(Employee Id) FROM Employees WHERE Hire_Date BETWEEN TO_DATE('01-JAN-2002', 'DD-MON-YYYY') AND TO_DATE('31-DEC-2005', 'DD-MON-YYYY');

Everything in capital letters are standard oracle SQL syntax.

What this query does is that it will return all the employee ids who where hired between starting of Jan 2002 to end of Dec 2005. The COUNT() function will then count the number of employee ids and return the count to the screen. To_Date() function helps to convert string to date. It accepts the format of the date as well in string format.