You are on page 1of 9

ACTS COMPUTER COLLEGE

Sta. Cruz, Laguna


2nd Semester, A.Y. 2022-2023

Midterm Examination
(APPS2 – Application Software 2)

Submitted by:
Joren D. Merciales

Submitted to:
MR. ARIEL JR. M. TOBIAS
IT Instructor

EMPLOYEE TABLE:
TASK 1: Provide the Correct SQL statement.
1. Display all Male employees.
SQL Statement: select * from employees WHERE GENDER = ‘M’;

2. Display all Male employees live in Texas.


SQL Statement: select *from employees WHERE GENDER = ‘M’ AND
STATE = ‘Texas’;

3. Display all employees worked at R&D Department.


SQL Statement: select * from employees WHERE DEPT = ‘R&D’;

4. Display all employees worked at Sales Department.


SQL Statement: select * from employees WHERE DEPT = ‘Sales’;

5. Count the number of Employees worked in every Department.


SQL Statement: SELECT Count(*), DEPT FROM Employees GROUP
BY DEPT;

6. Display all employees hired in year 2005.


SQL Statement: select * from employees WHERE HIREDATE
BETWEEN ‘2005-01-01’ AND ‘2005-12-31’;

7. Display all employees born between 1970 and 1980.


SQL Statement: select * from employees WHERE BIRTHDATE
BETWEEN ‘1970-01-01’ AND ‘1980-12-31*;

8. Display all employees with a salary of 10,000 and below.


SQL Statement: select * from employees WHERE SALARY <= 10000;

9. Compute the Salary of all Male employee in 1 year.


SQL Statement:SELECT SUM(SALARY) from employees WHERE GENDER
= ‘M’;
10. Display all employees AGE.
SQL Statement: select NAME,DATE_FORMAT(NOW(),‘%Y, %M, %d’)-
DATE_FORMAT(BIRTHDAY, %Y, %M, %d’) AS ‘AGE from employees

11. Compute the Annual Tax (8% of Salary) of all Female employee. SQL
Statement: SELECT *,ROUND(SALARY*0.08, 2) AS annual_tax FROM
Employees WHERE gender = ‘F’;

12. Combine the Surname and Name in one Column named FULLNAME.
SQL Statement: SELECT *, CONCAT(SURNAME, NAME) AS
FULLNAME from employees;

13. Format the BIRTHDAY in this format April 03, 2019, Wednesday SQL
Statement: SELECT NAME, SURNAME, DATA_FORMAT(BIRTHDATE,
‘%M, %d, %Y %W’) FROM EMPLOYEES;

14. Display male employee with the highest salary.


SQL Statement: select NAME, SURNAME, MAX(SALARY) from employees
WHERE GENDER = ‘M’;
15. Display employee with the highest salary worked at R&D Department.
SQL Statement: select NAME, SURNAME, DEPT, MAX(SALARY) from
employees WHERE DEPT = ‘R&D’;

16. Compute the 12% annual Tax of every employees. Taxes should be
rounded. SQL Statement: SELECT *,ROUND(SALARY * 0.12) AS
annual_tax from Employees;

17. Count the number of Male Employees and Female Employees. SQL
Statement: SELECT gender, Count(*) FROM employees GROUP BY
GENDER;

18. Display all employees hired in year 2006.


SQL Statement: SELECT * FROM employees WHERE YEAR(HIREDATE)
= 2006;

19. Count the Number of employees born between 1970 and 1980. SQL
Statement: SELECT Count(*), BIRTHDATE FROM Employees WHERE
BIRTHDATE BETWEEN ‘1970-01-01’ AND ‘1980-12-31

20.Display all employees with a salary of 10,000 and above.


SQL Statement: select*, FROM employees WHERE SALARY >= ‘10000’;
21. Compute the Salary of all Male employee in 3 year with their 13 th Month Pay.
SQL Statement: select*, FORMAT(SALARY*0.13,3)from employees WHERE
GENDER = ‘M’;

22.FULLNAME.
SQL Statement: SELECT *, CONCAT(SURNAME,‘,’, NAME) as FULLNAME
from employees;

23.Format the HIREDATE in this format April 03, 2019,


Wednesday.
SQL Statement: select NAME, DATE_FORMAT(HIREDATE,
‘%M,%d, %Y, %W’) from employees;

24.Display male employee with the highest salary.


SQL Statement: select NAME, SURNAME, SALARY, MAX(SALARY) from
employees WHERE GENDER =’M’;
25.Display employee with the highest salary worked at R&D Department.
SQL Statement: select NAME, SURNAME, SALARY, DEPT,
MAX(SALARY)from employees WHERE DEPT =’R&D’;

26.Compute the 12% annual Tax of every employees.


SQL Statement: SELECT NAME, SURNAME, SALARY,
SALARY*.12 PERCENT from employees ROUND;

27.Count the number of Male Employees and Female Employees. SQL


Statement: select COUNT(*), GENDER from employees GROUP BY
GENDER;

28.Display all employees hired in year 2008.


SQL Statement:select NAME from employees WHERE HIDEDATE
BETWWEN ‘2008-01-01’ AND ‘1980-12-31’;

29.Count the Number of employees born between 1970 and 1980. SQL
Statement: select COUNT(*) from employees WHERE BIRTHDATE
BETWEEN ‘1970-01-01’ AND ‘1980-12-31’;

30.Compute the Total Salary of all employees worked at Sales Department.


SQL Statement: select SUM(SALARY)from employees WHERE DEPT =
‘Sales’;

31. Display all employees with a salary of 10,000 and above


SQL Statement:select * from employees WHERE SALARY >=’10000’;

32.Compute the Salary of all Male employees in 3 years.


SQL Statement: select*, FORMAT(SALARY*0.13,3)from employees WHERE
GENDER = ‘M’;

33.Compute the 8% Monthly Tax of all Female employees in 3 years. SQL


Statement: SELECT NAME, SURNAME, SALARY, SALARY* .8 PERCENT
from employees WHERE GENDER = ‘F’;

34.Display the 35 years old and above with their all salary earned since they
were hired.
SQL Statement: select*, YEAR(NOW()-YEAR(BIRTHDATE) AS AGE,
(YEAR(NOW()) - YEAR(HIREDATE)) *SALARY AS ‘ SALARY SINCE
HIRED’ FROM EMPLOYEES;

35.Display the Employee Name and Surname in this format (A. TOBIAS).
SQL Statement: select UPPER(CONCAT(MID(NAME, 1, 1),“,“,“ “,
SURNAME))from employees;

APPS2 – Application Software 2 (DBMS) Page


36.Count the characters of Employee’s Full name (Name + Surname). SQL
Statement: select CONCAT(LENGTH(NAME), LENGTH(SURNAME))
from employees;
37.Display the 35 years old and above with the highest salary.
SQL Statement: select*, YEAR(NOW())-YEAR(BIRTHDATE) AS
AGE, MAX(SALARY) from employees;

38.Compute all the salary earn by every employee since they were hired until now.
SQL Statement:

TASK 2Format the Employees’ Birthday and Hire date with the following date
pattern:
39.Aug 08, 2018
SQL Statement: select NAME, SURNAME, DATE_FORMAT(BIRTHDATE,
‘%b %d, %Y’) AS BIRTHDATE, DATE_FORMAT(HIREDATE,‘%b %d, %Y’)
AS HIREDATE from employees;

40.Aug/08/18
SQL Statement: select NAME, SURNAME, DATE_FORMAT(BIRTHDATE,
‘%b %d %y’) AS BIRTHDATE, DATE_FORMAT(HIREDATE,‘%b %d %y;’)
AS HIREDATE from employees;

41. 8/08/2018, Wed


SQL Statement: select NAME, SURNAME,
DATE_FORMAT(BIRTHDATE, ‘%c/%d/%Y, %a’) AS BIRTHDATE,
DATE_FORMAT(HIREDATE,
‘%c/%d/%Y %a’) AS HIREDATE from employees;

42.08-August-2018
SQL Statement: select NAME, SURNAME, DATE_FORMAT(BIRTHDATE,‘%d-
%M-%Y’) AS BIRTHDATE, DATE_FORMAT(HIREDATE,‘%d-%M-%Y’) AS
HIREDATE from employees;

43.Wednesday, 8th of August, year 2018


SQL Statement: select NAME, SURNAME, DATE_FORMAT(BIRTHDATE,
‘%W, %D of %M, year %Y’) AS BIRTHDATE, DATE_FORMAT(HIDEDATE,‘W,
%D of %M, year %Y’) AS HIREDATE from employees;

44.Wed, 07:36:58
SQL Statement: select NAME, SURNAME,
DATE_FORMAT(BIRTHDATE,‘%a, %T’) AS BITHDATE,
DATE_FORMAT(HIREDATE,‘%a, %T’) AS HIREDATE from employees;

45.August 08/18
SQL Statement: select NAME, DURNAME, DATE_FORMAT(BIRTHDATE,
‘%M %d/%y’) AS BIRTHDATE, DATE_FORMAT(HIREDATE,’%M %d/%y’)
AS from employees;

APPS2 – Application Software 2 (DBMS) Page


Notes:
✔ Copying another person’s digital item or work is cheating. ✔
Cheating will result in the student receiving a failing grade ✔
Deadline:
✔ Save your work as PDF.
✔ Submit in the“Submission of Output”under the material section of
ACTS-VLE

APPS2 – Application Software 2 (DBMS) Page

You might also like