We read your photo as:

Write SQL queries for the following: display all employees in the IT department, total salary in HR, names hired before 2020, and insert a new employee.

Computer Science

ScanSolve AI Answer

Here are the SQL queries for question 19:

a) Write a query to display all employees in the IT department.

SELECT *
FROM Employee
WHERE department = 'IT';

b) Find the total salary paid to employees in the HR department.

SELECT SUM(salary) AS TotalHRSalary
FROM Employee
WHERE department = 'HR';

c) Write a query to display the names of employees hired before 2020.

SELECT Names
FROM Employee
WHERE HireDate < '2020-01-01';

d) Insert a new employee into the employees table with the following details: employeeID: 6.
(Assuming the missing details for the new employee are 'New Employee' for Names, 'Sales' for department, 75000 for salary, and '2023-01-01' for HireDate.)

INSERT INTO Employee (ID, Names, department, salary, HireDate)
VALUES (6, 'New Employee', 'Sales', 75000, '2023-01-01');
Was this helpful?

Still stuck on this one?

Ask a follow-up, and the answer starts from this question.

Got a different question?Ask your own question