SampleOfQuestions_SQL
SampleOfQuestions_SQL
a) Display all employees which received the bonus more than rm500.
Answer : select * from employee where bonus > 500
Evidence:
Evidence:
c) Display all staff which the bonus received is more than the average bonus received by all
staffs. Display the staff no, name, bonus, dept number and department name.
Answer : select e.empno, concat(e.firstname,' ',e.mid,'
',e.lastname) as fullname, e.bonus, d.deptno, d.deptname from employee e, department d
where e.dept = d.deptno and e.bonus > (select avg(bonus) from employee)
Evidence:
1
d) Display all staffs from the employee table which their last name ended with ‘SON’. Display
their empno, dept and fullname.
Answer:
Evidence:
e) Display all staffs from the employee table which attached to department number which start
with ‘A’.
Answer:
Evidence:
Evidence:
g) Update the department number from the table department for project named ‘OPERATION
SUPPORT’ to new department number ‘X99’.
Answer:
Evidence:
Evidence:
i) Display the empno, fullname, gender and how long the service (duration) of each employee.
Answer:
Evidence:
2
j) Determine the new salary for each employee if management decided to increase the salary
up to 15% from the current salary. Display the empno, fullname, current salary, new salary
and total increment. Format the currency until 2 decimal places.
Answer:
Evidence:
k) List all staffs who attached to the department named ‘MANUFACTURING SYSTEMS’.
For this type of question, the student is not allowed to use the deptno ‘D11’ for
‘MANUFACTURING SYSTEMS’. You must use the department name as mentioned in the
question.
Answer:
Evidence:
l) Count number of employees attached at each department. Dipslay the deptno and number
of employees.
Answer:
Evidence:
m) List the project number and project name which managed by ‘John’ (first name). You are not
allowed to refer what is the empno of ‘John’. Use the name as given.
Answer:
Evidence:
n) Display the empno, fullname, departname and projectname specifically for ‘Theodore’
Answer:
Evidence:
3
o) Determine list of employees which they are not the manager of the department. Display the
empno and fullname. [use subquery]
Answer:
Evidence:
p) Determine how many projects handled by each employee. Display the empno, fullname and
total project handled.
Answer:
Evidence:
q) Count number of employees which their salary more than average salary of all employees.
Answer:
Evidence:
Evidence:
s) List the depno, empno and fullname and salary which the salary is the highest in the
department.
Answer:
Evidence:
4
t) Display the total salary by the department. Display the deptno, department name and total
salary.
Answer:
Evidence:
u) Display the total duration of each project handled by each department and who handled the
project. Display the empno, fulllname, deptno, departname, projno, projname and duration
of the project.
Answer:
Evidence: