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

How to write these steps in SQL: SQL statement to select December 25 in the year

ID: 3758962 • Letter: H

Question

How to write these steps in SQL:

SQL statement to select December 25 in the year 2010 from the dual table. Use the TO_DATE function to convert the string to a date datatype.

SQL statement to show employee last name, first name, and hire date. Show only employees that were hired after January 1, 2000. Be sure to use the TO_DATE function in your WHERE clause.

SQL statement to show the number of rows in the employee table using the COUNT function

SQL statement to show the average salary of employees hired after January 1, 2000. Hint: use the AVG function.

SQL statement to show the total of all salaries paid to the employees who work in department_id 50.

SQL statement to show department_id and average salary for each department from the employees table. Hint: use a GROUP BY clause.

SQL statement to show department_id, and maximum salary for each department from the employees table. Do not show any departments that have a maximum salary of less than $10,000.00. Hint: use MAX function, GROUP BY, and HAVING clause.

SQL statement to show the department_name from the department table and the employee_id and last_name from the employees table for any employees who work in department number 30. Hint: JOIN the tables together. Don't forget to match the FK and PK from the two tables and restrict the query only to department number 30.

Explanation / Answer

select to_date("12/25/2010","mm/dd/yyyy") from dual;

select lname, fname, hdate from employees where hdate > to_date("1/1/2000","mm/dd/yyyy");

select count(empid) from employee;

select avg(salary) from employee where > to_date("1/1/2000","mm/dd/yyyy");

select sum(salary) from employee where department_id =50;

select department_id, avg(salary) from employee group by department_id;

select department_id, max(salary) from employee group by department_id having max(salary) <10000;

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote